13 changed files with 429 additions and 37 deletions
@ -0,0 +1,81 @@ |
|||
package com.zdxt.enforcementcode.controller.app.enforcement; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import cn.hutool.core.convert.Convert; |
|||
import com.zdxt.enforcementcode.common.util.CommonUtil; |
|||
import com.zdxt.enforcementcode.domain.EnterpriseLawEnforcement; |
|||
import com.zdxt.enforcementcode.domain.bo.EnterpriseLawEnforcementBo; |
|||
import com.zdxt.enforcementcode.domain.vo.EnterpriseLawEnforcementVo; |
|||
import com.zdxt.enforcementcode.service.IEnterpriseLawEnforcementService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.system.domain.vo.SysUserVo; |
|||
import org.dromara.system.service.ISysUserService; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.time.ZoneId; |
|||
import java.time.temporal.ChronoUnit; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 执法端-执法预报 |
|||
*/ |
|||
@Slf4j |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/app-enf/enforcement") |
|||
public class AppEnfEnterpriseLawEnforcementController { |
|||
|
|||
private final IEnterpriseLawEnforcementService enterpriseLawEnforcementService; |
|||
private final ISysUserService sysUserService; |
|||
|
|||
/** |
|||
* 执法端-执法预告列表 |
|||
*/ |
|||
@SaIgnore |
|||
@PostMapping("/queryList") |
|||
@ResponseBody |
|||
public TableDataInfo<EnterpriseLawEnforcementVo> queryList(@RequestBody EnterpriseLawEnforcementBo bo, PageQuery pageQuery) { |
|||
TableDataInfo<EnterpriseLawEnforcementVo> rspData = enterpriseLawEnforcementService.selectEnterpriseLawEnforcementVoPageByBo(bo, pageQuery); |
|||
|
|||
List<EnterpriseLawEnforcementVo> list = rspData.getRows(); |
|||
for (EnterpriseLawEnforcementVo vo : list) { |
|||
List<SysUserVo> userBeans = new ArrayList<>(); |
|||
if (StringUtils.isNotEmpty(vo.getLawEnforcerTwoId())) { |
|||
Long[] userIds = Convert.toLongArray(vo.getLawEnforcerTwoId()); |
|||
List<Long> userIdList = java.util.Arrays.asList(userIds); |
|||
userBeans = sysUserService.selectUserByIds(userIdList, null); |
|||
} |
|||
String tmpUserShow = ""; |
|||
for (SysUserVo ub : userBeans) { |
|||
String temp = ub.getLawCertificateNum(); |
|||
if(StringUtils.isEmpty(temp)) { |
|||
temp = CommonUtil.encryptPhone(ub.getPhonenumber()); |
|||
} |
|||
tmpUserShow += ub.getUserName() +" "+ temp + ","; |
|||
} |
|||
if (tmpUserShow.length() > 0) { |
|||
tmpUserShow = tmpUserShow.substring(0, tmpUserShow.length()-1); |
|||
} |
|||
vo.setLawEnforcer2Show(tmpUserShow); |
|||
|
|||
if(vo.getCheckTime() != null) { |
|||
LocalDate checkTime = vo.getCheckTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
|||
long daysBetween = ChronoUnit.DAYS.between(LocalDate.now(), checkTime); |
|||
if(vo.getStatus() != null && !vo.getStatus().equals(1L)) { |
|||
if (daysBetween < 0) { |
|||
vo.setStatus(3L); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
rspData.setRows(list); |
|||
return rspData; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue