Commit 620763b2 authored by hezhuozhi's avatar hezhuozhi

提交工作台信息

parent 79d851fa
...@@ -19,7 +19,7 @@ public enum BusinessTypeEnum { ...@@ -19,7 +19,7 @@ public enum BusinessTypeEnum {
HYGF_YSLC("AcceptanceCheck", "验收流程"), HYGF_YSLC("AcceptanceCheck", "验收流程"),
HYGF_BWLC("GridConnected", "并网流程"), HYGF_BWLC("GridConnected", "并网流程"),
HYGF_SGLCSH("ProcessEngineering", "施工流程审核"), HYGF_SGLCSH("ProcessEngineering", "施工流程审核"),
HYGF_REPAY("Repatment", "还款"), HYGF_REPAY("hygf_repayment", "还款"),
; ;
private final String code; private final String code;
......
...@@ -9,7 +9,8 @@ public enum TaskTypeStationEnum { ...@@ -9,7 +9,8 @@ public enum TaskTypeStationEnum {
电站审核("电站审核", "电站审核"), 电站审核("电站审核", "电站审核"),
合同填报("合同填报", "合同填报"), 合同填报("合同填报", "合同填报"),
重置密码("重置密码", "重置密码"), 重置密码("重置密码", "重置密码"),
设置管理员("设置管理员", "设置管理员"); 设置管理员("设置管理员", "设置管理员"),
还款("还款", "还款");
/** /**
* 名称,描述 * 名称,描述
*/ */
......
...@@ -71,7 +71,11 @@ public class ToDoTasks extends BaseEntity { ...@@ -71,7 +71,11 @@ public class ToDoTasks extends BaseEntity {
@TableField("amos_org_code") @TableField("amos_org_code")
private String amosOrgCode; private String amosOrgCode;
/**
*路由地址
*/
@TableField("route_path")
private String routePath;
public ToDoTasks(String type, Long businessId, String taskName,String orgCode) { public ToDoTasks(String type, Long businessId, String taskName,String orgCode) {
...@@ -83,6 +87,16 @@ public class ToDoTasks extends BaseEntity { ...@@ -83,6 +87,16 @@ public class ToDoTasks extends BaseEntity {
this.taskName = taskName; this.taskName = taskName;
} }
public ToDoTasks(String type, Long businessId, String taskName,String orgCode,String routePath) {
this.type = type;
this.businessId = businessId;
this.state = "待办";
this.amosOrgCode = orgCode;
this.creationTime = new Date();
this.taskName = taskName;
this.routePath = routePath;
}
public ToDoTasks() { public ToDoTasks() {
} }
} }
...@@ -17,7 +17,8 @@ import java.util.List; ...@@ -17,7 +17,8 @@ import java.util.List;
*/ */
public interface RepaymentMapper extends BaseMapper<Repayment> { public interface RepaymentMapper extends BaseMapper<Repayment> {
@UserEmpower(field = {"regional_companies_code"}, dealerField = {"regional_companies_code"}, fieldConditions = {"in"}, relationship = "and") @UserEmpower(field = {"regional_companies_code"}, dealerField = {"regional_companies_code"}, fieldConditions = {"in"}, relationship = "and")
List<RepaymentDto> queryPage(); List<RepaymentDto> queryPage(@Param("sequenceNbr") String sequenceNbr, @Param("companyName")String companyName, @Param("loanPeriod")String loanPeriod,
@Param("messageState")String messageState, @Param("repayState")String repayState);
/** /**
* 获取区域公司通过OrgCode * 获取区域公司通过OrgCode
...@@ -25,4 +26,14 @@ public interface RepaymentMapper extends BaseMapper<Repayment> { ...@@ -25,4 +26,14 @@ public interface RepaymentMapper extends BaseMapper<Repayment> {
* @return * @return
*/ */
PrivilegeCompany getPrivilegeCompanyByOrgCode(@Param("orgCode")String orgCode); PrivilegeCompany getPrivilegeCompanyByOrgCode(@Param("orgCode")String orgCode);
/**
* 根据角色和区域公司获取用户Id
* @param companyOrgCode
* @param roleId
* @return
*/
List<String> getTodoUserIds(@Param("companyOrgCode") String companyOrgCode, @Param("roleId") String roleId);
String getSequenceNbrByName(@Param("groupName") String groupName);
} }
...@@ -4,6 +4,23 @@ ...@@ -4,6 +4,23 @@
<select id="queryPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.RepaymentDto"> <select id="queryPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.RepaymentDto">
select * from hygf_repayment select * from hygf_repayment
<where>
<if test="sequenceNbr != null and sequenceNbr != ''">
and sequence_nbr = #{sequenceNbr}
</if>
<if test="companyName != null and companyName != ''">
and company_name like #{companyName}
</if>
<if test="loanPeriod != null and loanPeriod != ''">
and loan_period like #{loanPeriod}
</if>
<if test="messageState != null and messageState != ''">
and message_state = #{messageState}
</if>
<if test="repayState != null and repayState != ''">
and repay_state = #{repayState}
</if>
</where>
order by rec_date DESC order by rec_date DESC
</select> </select>
...@@ -12,4 +29,16 @@ ...@@ -12,4 +29,16 @@
SELECT * FROM privilege_company SELECT * FROM privilege_company
WHERE ORG_CODE=#{orgCode} LIMIT 1 WHERE ORG_CODE=#{orgCode} LIMIT 1
</select> </select>
<select id="getTodoUserIds" resultType="java.lang.String">
SELECT USER_ID FROM privilege_user_org_role puor LEFT JOIN std_user_empower sue ON sue.amos_user_id=puor.USER_ID
WHERE (sue.amos_org_code like #{companyOrgCode} or sue.amos_org_code like '%all%') and puor.ROLE_SEQ=#{roleId}
and sue.permission_type='HYGF'
GROUP BY USER_ID;
</select>
<select id="getSequenceNbrByName" resultType="java.lang.String">
SELECT SEQUENCE_NBR from privilege_group where GROUP_NAME=#{groupName} LIMIT 1
</select>
</mapper> </mapper>
...@@ -216,8 +216,13 @@ public class RepaymentController extends BaseController { ...@@ -216,8 +216,13 @@ public class RepaymentController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询") @ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public ResponseModel<Page<RepaymentDto>> queryForPage(@RequestParam(value = "current") int current, public ResponseModel<Page<RepaymentDto>> queryForPage(@RequestParam(value = "sequenceNbr",required = false) String sequenceNbr,
@RequestParam(value = "companyName",required = false) String companyName,
@RequestParam(value = "loanPeriod",required = false) String loanPeriod,
@RequestParam(value = "messageState",required = false) String messageState,
@RequestParam(value = "repayState",required = false) String repayState,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) { @RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(repaymentService.queryForRepaymentPage(current, size)); return ResponseHelper.buildResponse(repaymentService.queryForRepaymentPage(sequenceNbr, companyName,loanPeriod,messageState,repayState,current, size));
} }
} }
...@@ -68,7 +68,7 @@ public class CommonServiceImpl { ...@@ -68,7 +68,7 @@ public class CommonServiceImpl {
// private TaskV2FeignService taskV2FeignService; // private TaskV2FeignService taskV2FeignService;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Value("classpath:/json/urlInfo.json") @Value("classpath:/json/hygfRouth.json")
private Resource urlInfo; private Resource urlInfo;
@Autowired @Autowired
SurveyInformationServiceImpl surveyInformationServiceImpl; SurveyInformationServiceImpl surveyInformationServiceImpl;
...@@ -83,6 +83,23 @@ public class CommonServiceImpl { ...@@ -83,6 +83,23 @@ public class CommonServiceImpl {
private static final String TEMP_DIR_NAME = "temp"; private static final String TEMP_DIR_NAME = "temp";
private static final String TEMPLATE_FILE_PATH = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\test.xlsx"; // 模版文件路径 private static final String TEMPLATE_FILE_PATH = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\test.xlsx"; // 模版文件路径
public String getRouthPath(String type,Object model) {
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
String routhPath="";
String urlParams = "";
try {
urlParams = "&" + toQueryParams(model);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
for (Map map : urlList) {
if (map.get("type").equals(type)) {
routhPath = (map.get("url").toString() + urlParams);
break;
}
}
return routhPath;
}
// private static String toQueryParams2(JSONObject jsonObject) { // private static String toQueryParams2(JSONObject jsonObject) {
// StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
// Set<String> keys = jsonObject.keySet(); // Set<String> keys = jsonObject.keySet();
...@@ -376,32 +393,32 @@ public class CommonServiceImpl { ...@@ -376,32 +393,32 @@ public class CommonServiceImpl {
// } // }
// } // }
// public <T> String toQueryParams(T obj) throws UnsupportedEncodingException { private <T> String toQueryParams(T obj) throws UnsupportedEncodingException {
// StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
//
// for (Class<?> clazz = obj.getClass(); !clazz.equals(Object.class); clazz = clazz.getSuperclass()) { for (Class<?> clazz = obj.getClass(); !clazz.equals(Object.class); clazz = clazz.getSuperclass()) {
// Field[] fields = clazz.getDeclaredFields(); Field[] fields = clazz.getDeclaredFields();
//
// for (Field field : fields) { for (Field field : fields) {
// if (!Modifier.isStatic(field.getModifiers())) { if (!Modifier.isStatic(field.getModifiers())) {
// field.setAccessible(true); field.setAccessible(true);
//
// try { try {
// Object value = field.get(obj); Object value = field.get(obj);
//
// if (value != null && !"".equals(value)) { if (value != null && !"".equals(value)) {
// String encodedValue = URLEncoder.encode(value.toString(), "UTF-8"); String encodedValue = URLEncoder.encode(value.toString(), "UTF-8");
// sb.append(field.getName()).append('=').append(encodedValue).append('&'); sb.append(field.getName()).append('=').append(encodedValue).append('&');
// } }
// } catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
// throw new RuntimeException(e); throw new RuntimeException(e);
// } }
// } }
// } }
// } }
//
// return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : ""; return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : "";
// } }
// /** // /**
// * 更新并完成 // * 更新并完成
......
...@@ -15,13 +15,14 @@ import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils; ...@@ -15,13 +15,14 @@ import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.*; import com.yeejoin.amos.boot.module.hygf.api.Enum.*;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown; import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown;
import com.yeejoin.amos.boot.module.hygf.api.dto.RepaymentDto; import com.yeejoin.amos.boot.module.hygf.api.dto.RepaymentDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.PrivilegeCompany; import com.yeejoin.amos.boot.module.hygf.api.entity.PrivilegeCompany;
import com.yeejoin.amos.boot.module.hygf.api.entity.Repayment; import com.yeejoin.amos.boot.module.hygf.api.entity.Repayment;
import com.yeejoin.amos.boot.module.hygf.api.entity.ToDoTasks;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.RepaymentMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.RepaymentMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IRepaymentService; import com.yeejoin.amos.boot.module.hygf.api.service.IRepaymentService;
import com.yeejoin.amos.boot.module.hygf.biz.vo.RepaymentExcelVO; import com.yeejoin.amos.boot.module.hygf.biz.vo.RepaymentExcelVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -35,7 +36,10 @@ import javax.servlet.http.HttpServletResponse; ...@@ -35,7 +36,10 @@ import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -46,17 +50,21 @@ import java.util.regex.Pattern; ...@@ -46,17 +50,21 @@ import java.util.regex.Pattern;
* @date 2024-09-26 * @date 2024-09-26
*/ */
@Service @Service
@Slf4j
public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, RepaymentMapper> implements IRepaymentService { public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, RepaymentMapper> implements IRepaymentService {
@Autowired @Autowired
CommonServiceImpl commonService; ToDoTasksServiceImpl toDoTasksService;
@Autowired @Autowired
RepaymentMapper repaymentMapper; RepaymentMapper repaymentMapper;
@Autowired @Autowired
JpStationMapper jpStationMapper; JpStationMapper jpStationMapper;
@Autowired
CommonServiceImpl commonService;
public Page<RepaymentDto> queryForRepaymentPage(int current, int size) { public Page<RepaymentDto> queryForRepaymentPage(String sequenceNbr, String companyName, String loanPeriod,
String messageState, String repayState, int current, int size) {
PageHelper.startPage(current, size); PageHelper.startPage(current, size);
List<RepaymentDto> list = repaymentMapper.queryPage(); List<RepaymentDto> list = repaymentMapper.queryPage(sequenceNbr, "%" + companyName + "%", "%" + loanPeriod + "%", messageState, repayState);
PageInfo<RepaymentDto> pages = new PageInfo(list); PageInfo<RepaymentDto> pages = new PageInfo(list);
List<RepaymentDto> pagesList = pages.getList(); List<RepaymentDto> pagesList = pages.getList();
if (CollectionUtil.isNotEmpty(pagesList)) { if (CollectionUtil.isNotEmpty(pagesList)) {
...@@ -84,7 +92,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -84,7 +92,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
this.update(updateWrapper); this.update(updateWrapper);
for (String sequenceNbr : sequenceNbrList) { for (String sequenceNbr : sequenceNbrList) {
//更新工作台信息 //更新工作台信息
updateTaskModel(sequenceNbr); updateTodoTask(sequenceNbr);
} }
} }
...@@ -108,23 +116,18 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -108,23 +116,18 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
.eq(Repayment::getSequenceNbr, sequenceNbr); .eq(Repayment::getSequenceNbr, sequenceNbr);
this.update(updateWrapper); this.update(updateWrapper);
//更新工作台信息 //更新工作台信息
updateTaskModel(String.valueOf(sequenceNbr)); updateTodoTask(String.valueOf(sequenceNbr));
} }
/** /**
* 更新工作台信息 * 更新工作台信息
* @param sequenceNbr * @param sequenceNbr
*/ */
@Transactional(rollbackFor = Exception.class) @Async
private void updateTaskModel(String sequenceNbr) { private void updateTodoTask(String sequenceNbr) {
Map<String, Object> updateTaskParam = new HashMap<>(); Repayment repayment = repaymentMapper.selectById(sequenceNbr);
updateTaskParam.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.还款.getCode(), repayment.getSequenceNbr(), createTaskName(repayment), repayment.getRegionalCompaniesCode());
updateTaskParam.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); toDoTasksService.completeToDoTasks(toDoTasks, "");
updateTaskParam.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
updateTaskParam.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
updateTaskParam.put("model", sequenceNbr);
updateTaskParam.put("relationId", sequenceNbr);
// commonService.updateTaskModel(updateTaskParam);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -145,6 +148,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -145,6 +148,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
@Async @Async
private void execute() { private void execute() {
log.info("====================开始执行定时任务===========================");
List<Repayment> repaymentList = list(); List<Repayment> repaymentList = list();
if (CollectionUtil.isNotEmpty(repaymentList)) { if (CollectionUtil.isNotEmpty(repaymentList)) {
for (Repayment repayment : repaymentList) { for (Repayment repayment : repaymentList) {
...@@ -155,11 +159,13 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -155,11 +159,13 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
Boolean dateSend = betweenDay == 15 || betweenDay == 5 || betweenDay == 0; Boolean dateSend = betweenDay == 15 || betweenDay == 5 || betweenDay == 0;
if (dateSend && repayment.getCronSendState() == RepaymentCronSendStateEnum.SEND.getCode()) { if (dateSend && repayment.getCronSendState() == RepaymentCronSendStateEnum.SEND.getCode()) {
//生成待办 //生成待办
// WorkflowResultDto workflowResultDto = new WorkflowResultDto(); commonService.getRouthPath(BusinessTypeEnum.HYGF_REPAY.getCode(),repayment);
// workflowResultDto.setInstanceId(String.valueOf(repayment.getSequenceNbr())); ToDoTasks toDoTasks = new ToDoTasks(TaskTypeStationEnum.还款.getCode(), repayment.getSequenceNbr(), createTaskName(repayment), repayment.getRegionalCompaniesCode());
// commonService.buildTaskModel(commonService.buildTaskModelDto(repayment, workflowResultDto, BusinessTypeEnum.HYGF_REPAY)); String sequenceNbr = repaymentMapper.getSequenceNbrByName("户用光伏-投融");
List<String> todoUserIds = repaymentMapper.getTodoUserIds("%" + repayment.getRegionalCompaniesCode() + "%", sequenceNbr);
toDoTasksService.addToDoTasksByUserIds(todoUserIds, toDoTasks);
} }
if (repayment.getCronSendState() < 0) { if (betweenDay < 0) {
//关闭定时任务 //关闭定时任务
LambdaUpdateWrapper<Repayment> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<Repayment> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(Repayment::getCronSendState, RepaymentCronSendStateEnum.UN_SEND.getCode()) updateWrapper.set(Repayment::getCronSendState, RepaymentCronSendStateEnum.UN_SEND.getCode())
...@@ -168,6 +174,25 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -168,6 +174,25 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
} }
} }
} }
log.info("==================定时任务执行完成====================");
}
private String createTaskName(Repayment repayment) {
StringBuilder taskNameBuilder = new StringBuilder();
taskNameBuilder.append("您于");
taskNameBuilder.append(repayment.getRepayDate().getYear());
taskNameBuilder.append("年");
taskNameBuilder.append(repayment.getRepayDate().getMonthValue());
taskNameBuilder.append("月");
taskNameBuilder.append(repayment.getRepayDate().getDayOfMonth());
taskNameBuilder.append("日");
taskNameBuilder.append("之前需要对");
taskNameBuilder.append(repayment.getCompanyName());
taskNameBuilder.append("区域公司进行还款,");
taskNameBuilder.append("金额为");
taskNameBuilder.append(repayment.getRent());
taskNameBuilder.append("元");
return taskNameBuilder.toString();
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -233,37 +258,37 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -233,37 +258,37 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
throw new BadRequest("模板列不是7个"); throw new BadRequest("模板列不是7个");
} }
String companyName = String.valueOf(objects.get(0)); String companyName = String.valueOf(objects.get(0));
if(StrUtil.isEmpty(companyName)){ if (StrUtil.isEmpty(companyName)) {
throw new BadRequest("区域公司不能为空"); throw new BadRequest("区域公司不能为空");
} }
String period = String.valueOf(objects.get(1)); String period = String.valueOf(objects.get(1));
if(StrUtil.isEmpty(period)){ if (StrUtil.isEmpty(period)) {
throw new BadRequest("期次不能为空"); throw new BadRequest("期次不能为空");
} }
String repayDate = String.valueOf(objects.get(2)); String repayDate = String.valueOf(objects.get(2));
if(StrUtil.isEmpty(repayDate)){ if (StrUtil.isEmpty(repayDate)) {
throw new BadRequest("还款日期不能为空"); throw new BadRequest("还款日期不能为空");
} }
Date date = DateUtils.dateParse(repayDate); Date date = DateUtils.dateParse(repayDate);
if (Objects.isNull(date)){ if (Objects.isNull(date)) {
throw new BadRequest("还款日期格式不对"); throw new BadRequest("还款日期格式不对");
} }
String rent = String.valueOf(objects.get(3)); String rent = String.valueOf(objects.get(3));
if(StrUtil.isEmpty(rent)){ if (StrUtil.isEmpty(rent)) {
throw new BadRequest("租金不能为空"); throw new BadRequest("租金不能为空");
} }
String interest = String.valueOf(objects.get(4)); String interest = String.valueOf(objects.get(4));
if(StrUtil.isEmpty(interest)){ if (StrUtil.isEmpty(interest)) {
throw new BadRequest("利息不能为空"); throw new BadRequest("利息不能为空");
} }
String principal = String.valueOf(objects.get(5)); String principal = String.valueOf(objects.get(5));
if(StrUtil.isEmpty(principal)){ if (StrUtil.isEmpty(principal)) {
throw new BadRequest("本金不能为空"); throw new BadRequest("本金不能为空");
} }
checkMoney(rent,interest,principal); checkMoney(rent, interest, principal);
String loanPeriod = String.valueOf(objects.get(6)); String loanPeriod = String.valueOf(objects.get(6));
if(StrUtil.isEmpty(loanPeriod)){ if (StrUtil.isEmpty(loanPeriod)) {
throw new BadRequest("放款批次不能为空"); throw new BadRequest("放款批次不能为空");
} }
} }
...@@ -273,15 +298,15 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -273,15 +298,15 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
String regex = "^([1-9]\\d{0,9}|0)([.]?|(\\.\\d{1,2})?)$"; String regex = "^([1-9]\\d{0,9}|0)([.]?|(\\.\\d{1,2})?)$";
Pattern pattern = Pattern.compile(regex); Pattern pattern = Pattern.compile(regex);
Matcher rentMatcher = pattern.matcher(rent); Matcher rentMatcher = pattern.matcher(rent);
if(!rentMatcher.find()){ if (!rentMatcher.find()) {
throw new BadRequest("租金金额格式不对"); throw new BadRequest("租金金额格式不对");
} }
Matcher interestMatcher = pattern.matcher(interest); Matcher interestMatcher = pattern.matcher(interest);
if(!interestMatcher.find()){ if (!interestMatcher.find()) {
throw new BadRequest("利息金额格式不对"); throw new BadRequest("利息金额格式不对");
} }
Matcher principalMatcher = pattern.matcher(principal); Matcher principalMatcher = pattern.matcher(principal);
if(!principalMatcher.find()){ if (!principalMatcher.find()) {
throw new BadRequest("本金金额格式不对"); throw new BadRequest("本金金额格式不对");
} }
} }
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.TasksRole; import com.yeejoin.amos.boot.module.hygf.api.dto.TasksRole;
...@@ -14,6 +16,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.UserMessage; ...@@ -14,6 +16,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.UserMessage;
import com.yeejoin.amos.boot.module.hygf.api.mapper.ToDoTasksMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.ToDoTasksMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.UserMessageMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.UserMessageMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IToDoTasksService; import com.yeejoin.amos.boot.module.hygf.api.service.IToDoTasksService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -47,6 +50,8 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD ...@@ -47,6 +50,8 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
@Autowired @Autowired
protected EmqKeeper emqKeeper; protected EmqKeeper emqKeeper;
@Autowired
Sequence sequence;
final static Logger log = LoggerFactory.getLogger(ToDoTasksServiceImpl.class); final static Logger log = LoggerFactory.getLogger(ToDoTasksServiceImpl.class);
...@@ -78,7 +83,52 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD ...@@ -78,7 +83,52 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
return toDoTasksPage; return toDoTasksPage;
} }
@Transactional
public void completeToDoTasks(ToDoTasks toDoTasks,String meg) {
try {
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, toDoTasks.getType());
wrapper.eq(ToDoTasks::getState, "待办");
wrapper.eq(ToDoTasks::getBusinessId, toDoTasks.getBusinessId());
List<ToDoTasks> doTasks= toDoTasksMapper.selectList(wrapper);
if(CollectionUtils.isNotEmpty(doTasks)){
for (ToDoTasks doTask : doTasks) {
doTask.setState("已办");
doTask.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTask);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTask.getType(), doTask.getBusinessId(), doTask.getAmosUserId(), new Date(), doTask.getTaskName()+"已完成."+meg, doTask.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}
}catch (Exception e){
e.printStackTrace();
throw new BadRequest("任务更新失败!");
}
}
@Transactional
public void addToDoTasksByUserIds(List<String> userIds, ToDoTasks toDoTasks) {
try {
if(CollectionUtil.isNotEmpty(userIds)){
for (String todoUserId : userIds) {
toDoTasks.setAmosUserId(todoUserId);
toDoTasks.setSequenceNbr(sequence.nextId());
toDoTasksMapper.insert(toDoTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(toDoTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName()+"待完成", toDoTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}else {
log.error("用户为空,不进行添加待办和发送消息");
}
}catch (Exception e){
e.printStackTrace();
throw new BadRequest("任务添加失败!");
}
}
@Override @Override
@Transactional @Transactional
......
[
{
"type": "AbarbeitungWaitPush",
"pageType": "",
"name": "推送融资",
"url": "/mixuap?appId=1678340647909617665&id=1774627124162859009"
},
{
"type": "WaitAbarbeitung",
"pageType": "",
"name": "经销商整改",
"url": "/mixuap?appId=1678340647909617665&id=1806150815363108865"
},
{
"type": "FinancingAudit",
"pageType": "",
"name": "融资审核",
"url": "/mixuap?appId=1678340647909617665&id=1775075407041662977"
},
{
"type": "AuditPass",
"pageType": "",
"name": "线下放款",
"url": "/mixuap?appId=1678340647909617665&id=1805852764345995265"
},
{
"type": "jxs_03",
"pageType": "",
"name": "经销商管理员审核",
"url": "/mixuap?appId=1678340647909617665&id=1686219644483956738"
},
{
"type": "hygf_02",
"pageType": "",
"name": "经销商确认",
"url": "/mixuap?appId=1677158789557547009&id=1677158800043307009"
},
{
"type": "hygf_03",
"pageType": "",
"name": "设计审核",
"url": "/mixuap?appId=1677158789557547009&id=1680021027779801090"
},
{
"type": "hygf_05",
"pageType": "",
"name": "投融审核",
"url": "/mixuap?appId=1677158789557547009&id=1680021027779801090"
},
{
"type": "hygf_07",
"pageType": "",
"name": "法务审核",
"url": "/mixuap?appId=1677158789557547009&id=1680021027779801090"
},
{
"type": "hygf_09",
"pageType": "",
"name": "设计上传典型图库",
"url": "/mixuap?appId=1677158789557547009&id=1680021027779801090"
},
{
"type": "hygf_10",
"pageType": "",
"name": "经销商设计人员上传设计图",
"url": "/mixuap?appId=1677158789557547009&id=1680021027779801090"
},
{
"type": "hygf_11",
"pageType": "",
"name": "设计图纸审核",
"url": "/mixuap?appId=1677158789557547009&id=1680021027779801090"
},
{
"type": "hygf_bw1",
"pageType": "",
"name": "并网登记提交",
"url": "/mixuap?appId=1677158789557547009&id=1747156510238076929"
},
{
"type": "hygf_bw2",
"pageType": "",
"name": "并网管理端工程审核",
"url": "/mixuap?appId=1678340647909617665&id=1747528027618701313"
},
{
"type": "hygf_ys1",
"pageType": "",
"name": "经销商工程提交验收",
"url": "/mixuap?appId=1677158789557547009&id=1747168313215053826"
},
{
"type": "hygf_ys2",
"pageType": "",
"name": "管理端投融审核",
"url": "/mixuap?appId=1678340647909617665&id=1747528027618701313"
},
{
"type": "hygf_zg_tr",
"pageType": "",
"name": "整改单",
"url": "/mixuap?appId=1677158789557547009&id=1747168313215053826"
},
{
"type": "hygf_ys3",
"pageType": "",
"name": "管理端法务审核",
"url": "/mixuap?appId=1678340647909617665&id=1747528027618701313"
},
{
"type": "hygf_zg_fw",
"pageType": "",
"name": "整改单",
"url": "/mixuap?appId=1677158789557547009&id=1747168313215053826"
},
{
"type": "hygf_ys4",
"pageType": "",
"name": "管理端工程审核",
"url": "/mixuap?appId=1678340647909617665&id=1747528027618701313"
},
{
"type": "hygf_zg_gc",
"pageType": "",
"name": "整改单",
"url": "/mixuap?appId=1677158789557547009&id=1747168313215053826"
},
{
"type": "hygf_ys5",
"pageType": "",
"name": "管理端工程是否线下",
"url": "/mixuap?appId=1678340647909617665&id=1747528027618701313"
},
{
"type": "hygf_ys6",
"pageType": "",
"name": "管理端工程线下验",
"url": "/mixuap?appId=1678340647909617665&id=1747528027618701313"
},
{
"type": "hygf_zg_xx",
"pageType": "",
"name": "整改单",
"url": "/mixuap?appId=1677158789557547009&id=1747168313215053826"
},
{
"type": "fh_dtj",
"pageType": "",
"name": "待发货",
"url": ""
},
{
"type": "fh_dyr",
"pageType": "",
"name": "待确认",
"url": ""
},
{
"type": "fh_dsh",
"pageType": "",
"name": "待审核",
"url": ""
},
{
"type": "fh_sqbh",
"pageType": "",
"name": "申请补货",
"url": ""
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "下发整改单",
"url": ""
},
{
"type": "Activity_0ku0pw4",
"pageType": "",
"name": "填写整改单",
"url": ""
},
{
"type": "Activity_0e6eabb",
"pageType": "",
"name": "整改单审核",
"url": ""
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "验收提交",
"url": ""
},
{
"type": "Activity_0ojajec",
"pageType": "",
"name": "经销商管理员审核",
"url": ""
},
{
"type": "Activity_0edftmv",
"pageType": "",
"name": "片区审核",
"url": ""
},
{
"type": "Activity_1rjn5s1",
"pageType": "",
"name": "投融/法务审核",
"url": ""
},
{
"type": "Activity_0rbc0gc",
"pageType": "",
"name": "资产审核",
"url": ""
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "并网登记",
"url": ""
},
{
"type": "Activity_0r2x1es",
"pageType": "",
"name": "经销商管理审核",
"url": ""
},
{
"type": "Activity_05nlkey",
"pageType": "",
"name": "片区审核",
"url": ""
},
{
"type": "Activity_0k4o46e",
"pageType": "",
"name": "设计审核/工程审核",
"url": ""
},
{
"type": "Activity_0bs6t4g",
"pageType": "",
"name": "施工完成提交",
"url": ""
},
{
"type": "Activity_1spujef",
"pageType": "",
"name": "完工登记提交",
"url": ""
},
{
"type": "Activity_16r1828",
"pageType": "",
"name": "完工自审",
"url": ""
},
{
"type": "Activity_1bldcno",
"pageType": "",
"name": "完工自审-片区运营中心",
"url": ""
},
{
"type": "Activity_1yftt2k",
"pageType": "",
"name": "工程审核",
"url": ""
},
{
"type": "Activity_095if3p",
"pageType": "",
"name": "设计审核",
"url": ""
},
{
"type": "hygf_repayment",
"pageType": "",
"name": "还款管理",
"url": "/mixuap?appId=1678340647909617665&id=1846106343904120833"
}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment