| | |
| | | import com.project.system.domain.bo.editBo.CheckBo; |
| | | import com.project.system.domain.bo.editBo.SysCompanyBo; |
| | | import com.project.system.service.ISysCompanyService; |
| | | import com.project.system.service.ISysUserService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | public class CheckServiceImpl implements ICheckService |
| | | { |
| | | |
| | | private final ISysUserService userService; |
| | | private final ISysCompanyService companyService; |
| | | private final IEnforceOrderService orderService; |
| | | private final IEnforceCheckLogService checkLogService; |
| | |
| | | } |
| | | SysCompanyBo companyBo = new SysCompanyBo(); |
| | | companyBo.setCompanyId(company.getCompanyId()); |
| | | if (company.getCheckStatus()!=0){ |
| | | throw new BaseException("该企业已审批!"); |
| | | } |
| | | if (bo.getCheckStatus()== -1){ |
| | | company.setCheckStatus(-1); |
| | | companyBo.setCompanyStatus(1); |
| | | smsService.sendCompanyCheckMsg(company.getCompanyPhone(), -1); |
| | | } else { |
| | | company.setCheckStatus(2); |
| | | companyBo.setCompanyStatus(0); |
| | | smsService.sendCompanyCheckMsg(company.getCompanyPhone(), 2); |
| | | } |
| | | addCheckLog(company, bo); |
| | | company.setCheckReason(bo.getCheckReason()); |
| | |
| | | if (order==null) { |
| | | throw new BaseException("没有找到对应数据,请检查审核类型!"); |
| | | } |
| | | if (order.getOrderStatus()!=1){ |
| | | throw new BaseException("该执法单已审批"); |
| | | } |
| | | addCheckLog(order, bo); |
| | | if (bo.getCheckStatus()==-1){ |
| | | order.setOrderStatus(-1); |
| | | order.setCheckStatus(-1); |
| | | //审批拒绝,给申请人发送短信,如果通知企业也给企业发送短信 |
| | | smsService.sendCheckMsg(order.getApplyPhone(), order.getCheckStatus()); |
| | |
| | | } else { |
| | | List<String> phones = orderService.getCheckPhones(order.getCheckLevel()+1, order.getApplyDeptId()); |
| | | if (StringUtils.isNotEmpty(phones)){ |
| | | int checkLevel = Integer.parseInt(phones.get(0)); |
| | | order.setCheckLevel(checkLevel); |
| | | phones.remove(0); |
| | | order.setCheckStatus(1); |
| | | //给下一级审批人发送短信 |
| | | smsService.sendApplyMsg(phones, order.getApplyUser()); |
| | | String checkPhones = StringUtils.join(phones, ","); |
| | | orderService.update(orderService.lu().set(EnforceOrder::getCheckIds, checkPhones).eq(EnforceOrder::getOrderId, order.getOrderId())); |
| | | order.setCheckIds(checkPhones); |
| | | order.setCheckReason(bo.getCheckReason()); |
| | | |
| | | return orderService.updateById(order); |
| | | } else { |
| | | order.setCheckStatus(2); |
| | | order.setOrderStatus(2); |
| | | //审批通过,给申请人发送短信,如果通知企业也给企业发送短信 |
| | | smsService.sendCheckMsg(order.getApplyPhone(), order.getCheckStatus()); |
| | | if (order.getIsNoticeCompany()==1){ |
| | | |
| | | if (StringUtils.isEmpty(order.getCompanyCode())){ |
| | | order.setOrderStatus(3); |
| | | order.setInTime(DateUtils.getNowDate()); |
| | | order.setExecuteDeptId(order.getApplyDeptId()); |
| | | order.setExecuteDeptName(order.getApplyDeptName()); |
| | | order.setExecuteUser(order.getApplyUser()); |
| | | order.setExecutePhone(order.getApplyPhone()); |
| | | order.setExecuteId(order.getApplyId()); |
| | | } |
| | | if (order.getIsNoticeCompany()==1 && StringUtils.isNotEmpty(order.getCompanyPhone())){ |
| | | smsService.sendCompanyMsg(order.getCompanyPhone(), order.getApplyDeptName(), order.getPlanTime()); |
| | | } |
| | | |
| | | //审批等级加1 |
| | | order.setCheckLevel(order.getCheckLevel()+1); |
| | | order.setCheckReason(bo.getCheckReason()); |
| | | return orderService.updateById(order); |
| | | } |
| | | //审批等级加1 |
| | | order.setCheckLevel(order.getCheckLevel()+1); |
| | | order.setCheckReason(bo.getCheckReason()); |
| | | orderService.updateById(order); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | EnforceCheckLog checkLog = Convert.convert(EnforceCheckLog.class, obj); |
| | | checkLog.setCheckType(bo.getCheckType()); |
| | | SysUser loginUser = SecurityUtils.getLoginUser().getUser(); |
| | | SysUser loginUser = userService.selectUserById(SecurityUtils.getUserId()); |
| | | checkLog.setCheckId(loginUser.getUserId()); |
| | | checkLog.setCheckUser(loginUser.getUserName()); |
| | | checkLog.setCheckUser(loginUser.getNickName()); |
| | | checkLog.setCheckPhone(loginUser.getPhonenumber()); |
| | | checkLog.setCheckStatus(bo.getCheckStatus()>0?1:-1); |
| | | checkLog.setCheckTime(DateUtils.getNowDate()); |