Showing
10 changed files
with
58 additions
and
0 deletions
| ... | ... | @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation; |
| 20 | 20 | import com.lframework.starter.common.utils.CollectionUtil; |
| 21 | 21 | import io.swagger.annotations.Api; |
| 22 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 23 | 24 | import org.springframework.validation.annotation.Validated; |
| 24 | 25 | import org.springframework.web.bind.annotation.*; |
| 25 | 26 | |
| ... | ... | @@ -106,4 +107,14 @@ public class CorePersonnelController extends DefaultBaseController { |
| 106 | 107 | |
| 107 | 108 | return InvokeResultBuilder.success(); |
| 108 | 109 | } |
| 110 | + | |
| 111 | + @Scheduled(cron = "0 0 0 1 1 ?") | |
| 112 | + @ApiOperation("自动更新年龄") | |
| 113 | + @GetMapping("/updateAge") | |
| 114 | + public InvokeResult<Void> updateAge() { | |
| 115 | + | |
| 116 | + corePersonnelService.updateAge(); | |
| 117 | + | |
| 118 | + return InvokeResultBuilder.success(); | |
| 119 | + } | |
| 109 | 120 | } | ... | ... |
| ... | ... | @@ -17,6 +17,7 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException; |
| 17 | 17 | import io.swagger.annotations.ApiOperation; |
| 18 | 18 | import com.lframework.starter.common.utils.CollectionUtil; |
| 19 | 19 | import io.swagger.annotations.Api; |
| 20 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 20 | 21 | import org.springframework.web.bind.annotation.DeleteMapping; |
| 21 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | 23 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -106,4 +107,14 @@ public class CorePersonnelHistoryController extends DefaultBaseController { |
| 106 | 107 | |
| 107 | 108 | return InvokeResultBuilder.success(); |
| 108 | 109 | } |
| 110 | + | |
| 111 | + @Scheduled(cron = "0 0 0 1 1 ?") | |
| 112 | + @ApiOperation("自动更新年龄") | |
| 113 | + @GetMapping("/updateAge") | |
| 114 | + public InvokeResult<Void> updateAge() { | |
| 115 | + | |
| 116 | + corePersonnelHistoryService.updateAge(); | |
| 117 | + | |
| 118 | + return InvokeResultBuilder.success(); | |
| 119 | + } | |
| 109 | 120 | } | ... | ... |
| ... | ... | @@ -242,6 +242,15 @@ public class CorePersonnelHistoryServiceImpl extends BaseMpServiceImpl<CorePerso |
| 242 | 242 | return data; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | + @OpLog(type = OtherOpLogType.class, name = "年龄自动+1,ID:{}", params = {"#id"}) | |
| 246 | + @Transactional(rollbackFor = Exception.class) | |
| 247 | + @Override | |
| 248 | + public void updateAge() { | |
| 249 | + | |
| 250 | + getBaseMapper().updateAge(); | |
| 251 | + } | |
| 252 | + | |
| 253 | + | |
| 245 | 254 | @CacheEvict(value = CorePersonnelHistory.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |
| 246 | 255 | @Override |
| 247 | 256 | public void cleanCacheByKey(Serializable key) { | ... | ... |
| ... | ... | @@ -146,6 +146,14 @@ public class CorePersonnelServiceImpl extends BaseMpServiceImpl<CorePersonnelMap |
| 146 | 146 | getBaseMapper().deleteById(id); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | + @OpLog(type = OtherOpLogType.class, name = "年龄自动+1,ID:{}", params = {"#id"}) | |
| 150 | + @Transactional(rollbackFor = Exception.class) | |
| 151 | + @Override | |
| 152 | + public void updateAge() { | |
| 153 | + | |
| 154 | + getBaseMapper().updateAge(); | |
| 155 | + } | |
| 156 | + | |
| 149 | 157 | @CacheEvict(value = CorePersonnel.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |
| 150 | 158 | @Override |
| 151 | 159 | public void cleanCacheByKey(Serializable key) { | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/customer/CorePersonnelHistoryService.java
| ... | ... | @@ -57,4 +57,6 @@ public interface CorePersonnelHistoryService extends BaseMpService<CorePersonnel |
| 57 | 57 | void updateWithChangeInfo(List<CorePersonnelHistory> beforeList, List<CorePersonnelHistory> afterList); |
| 58 | 58 | |
| 59 | 59 | CorePersonnelHistory changeCorePersonnel(CorePersonnel vo); |
| 60 | + | |
| 61 | + void updateAge(); | |
| 60 | 62 | } | ... | ... |