|
@@ -1,20 +1,37 @@
|
|
|
package platform.modules.test;
|
|
package platform.modules.test;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.aliyuncs.exceptions.ClientException;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
import platform.RootApplication;
|
|
import platform.RootApplication;
|
|
|
|
|
+import platform.common.Constant;
|
|
|
|
|
+import platform.common.util.AlibabaSMSUtil;
|
|
|
|
|
+import platform.common.util.DateUtil;
|
|
|
|
|
+import platform.common.util.StringUtils;
|
|
|
|
|
+import platform.modules.api.dto.CompanyInfoDto;
|
|
|
|
|
+import platform.modules.build.service.CompanyService;
|
|
|
|
|
+import platform.modules.company.entity.StockLand;
|
|
|
|
|
+import platform.modules.company.service.StockLandService;
|
|
|
import platform.modules.government.dto.GovIndustrialLandSupplyProjectNumDto;
|
|
import platform.modules.government.dto.GovIndustrialLandSupplyProjectNumDto;
|
|
|
import platform.modules.government.entity.Street;
|
|
import platform.modules.government.entity.Street;
|
|
|
|
|
+import platform.modules.government.entity.User;
|
|
|
|
|
+import platform.modules.government.service.Company;
|
|
|
import platform.modules.government.service.GovStatisticsService;
|
|
import platform.modules.government.service.GovStatisticsService;
|
|
|
import platform.modules.government.service.StreetService;
|
|
import platform.modules.government.service.StreetService;
|
|
|
|
|
+import platform.modules.government.service.UserService;
|
|
|
|
|
+import platform.modules.sys.entity.Approval;
|
|
|
import platform.modules.sys.entity.Group;
|
|
import platform.modules.sys.entity.Group;
|
|
|
|
|
+import platform.modules.sys.service.ApprovalService;
|
|
|
import platform.modules.sys.service.GroupService;
|
|
import platform.modules.sys.service.GroupService;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
@SpringBootTest(classes = {RootApplication.class})
|
|
@SpringBootTest(classes = {RootApplication.class})
|
|
|
@RunWith(SpringRunner.class)
|
|
@RunWith(SpringRunner.class)
|
|
@@ -24,10 +41,130 @@ public class StockLandTest {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private GroupService groupService;
|
|
private GroupService groupService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private StockLandService stockLandService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ApprovalService approvalService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private UserService userService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CompanyService companyService;
|
|
|
|
|
+
|
|
|
|
|
+ // 默认wei.pp的电话号码
|
|
|
|
|
+ @Value("${company-master-phone:18362602202}")
|
|
|
|
|
+ private String companyMasterPhone;
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
public void getStreet() {
|
|
public void getStreet() {
|
|
|
Group group = groupService.findByName("工业用地简易流程审核组", null);
|
|
Group group = groupService.findByName("工业用地简易流程审核组", null);
|
|
|
System.out.println(group);
|
|
System.out.println(group);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void findAllNeedJudgeStockLand() throws ClientException, InterruptedException, ParseException {
|
|
|
|
|
+ List<StockLand> allNeedJudgeStockLand = stockLandService.findAllNeedJudgeStockLand();
|
|
|
|
|
+ System.out.println(allNeedJudgeStockLand);
|
|
|
|
|
+ if (!allNeedJudgeStockLand.isEmpty()) {
|
|
|
|
|
+ for (StockLand stockLand : allNeedJudgeStockLand) {
|
|
|
|
|
+ Approval latestApproval = approvalService.getLatestApproval(stockLand.getId(), Constant.DictionaryType.STOCKLAND);
|
|
|
|
|
+ // 最后一个审批超过5天的 开始自动审批
|
|
|
|
|
+ Boolean overTime = DateUtil.isOverTime(latestApproval.getCreate_time(), 5);
|
|
|
|
|
+ if (!overTime) continue;
|
|
|
|
|
+ // 测试代码
|
|
|
|
|
+ if (!Objects.equals(stockLand.getApply_no(), "20230821102242")) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String nextchecker = latestApproval.getNextchecker();
|
|
|
|
|
+ if (!StringUtils.isEmpty(nextchecker)) {
|
|
|
|
|
+ List<String> checkers = new ArrayList<>(Arrays.asList(nextchecker.split(",")));
|
|
|
|
|
+ // 审批到最后一个人的时候,需要判断下一个审批人是到哪里?
|
|
|
|
|
+ if (!checkers.isEmpty()) {
|
|
|
|
|
+ Iterator<String> checkersIterator = checkers.iterator();
|
|
|
|
|
+ while (checkersIterator.hasNext()) {
|
|
|
|
|
+ String currentChecker = checkersIterator.next();
|
|
|
|
|
+ checkersIterator.remove();
|
|
|
|
|
+ if (checkers.isEmpty()) {
|
|
|
|
|
+ //下一审核人到“协调工作组”,
|
|
|
|
|
+ String nextChecker = stockLandService.findGroupName(Constant.XTGZXZ);
|
|
|
|
|
+ // 最后一个人了,下一个审批人的选择
|
|
|
|
|
+ if (Objects.equals(stockLand.getApprove_status(), Constant.LandApproveStatus.JYLCHQ)) {
|
|
|
|
|
+ // 简易流程会签,后面是简易流程汇总
|
|
|
|
|
+ //当最后一个人审核后,将该单据的状态设为“简易流程汇总”
|
|
|
|
|
+ stockLand.setApprove_status(Constant.LandApproveStatus.JYLCHZ);
|
|
|
|
|
+ stockLandService.save(stockLand);
|
|
|
|
|
+ stockLandService.autoSaveApproval(stockLand.getId(),
|
|
|
|
|
+ "超时自动审批通过",
|
|
|
|
|
+ currentChecker,
|
|
|
|
|
+ nextChecker,
|
|
|
|
|
+ latestApproval.getAfter_approvalstatus(),
|
|
|
|
|
+ Constant.LandApproveStatus.JYLCHZ,
|
|
|
|
|
+ Constant.OperType.SUBMIT_COMMENT,
|
|
|
|
|
+ latestApproval.getApproval_round());
|
|
|
|
|
+
|
|
|
|
|
+ } else if (Objects.equals(stockLand.getApprove_status(), Constant.LandApproveStatus.COMPLIANCE_AUDIT)) {
|
|
|
|
|
+ // 合规行审查,后面是合规性审查汇总
|
|
|
|
|
+ //当最后一个人审核后,将该单据的状态设为“合规性审查汇总”
|
|
|
|
|
+ stockLand.setApprove_status(Constant.LandApproveStatus.HGXSCTG);
|
|
|
|
|
+ stockLandService.saveStatus(stockLand);
|
|
|
|
|
+ stockLandService.autoSaveApproval(stockLand.getId(),
|
|
|
|
|
+ "超时自动审批通过",
|
|
|
|
|
+ currentChecker,
|
|
|
|
|
+ nextChecker,
|
|
|
|
|
+ latestApproval.getAfter_approvalstatus(),
|
|
|
|
|
+ Constant.LandApproveStatus.HGXSCTG,
|
|
|
|
|
+ Constant.OperType.SUBMIT_COMMENT,
|
|
|
|
|
+ latestApproval.getApproval_round());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 发送短信
|
|
|
|
|
+ // 获取申请单的创建人,并获取该创建人的公司
|
|
|
|
|
+ Integer userid = stockLand.getCreate_by();
|
|
|
|
|
+ CompanyInfoDto company = companyService.findByUserId(userid);
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
|
|
+ params.put("company_name", company.getCompany_name());
|
|
|
|
|
+
|
|
|
|
|
+ String tempCode = Constant.SMS_TemplateCode.STOCKLAND_HGXSCTG;
|
|
|
|
|
+
|
|
|
|
|
+ for (String checkerId : nextChecker.split(",")) {
|
|
|
|
|
+ User checker = userService.findById(Integer.valueOf(checkerId));
|
|
|
|
|
+ AlibabaSMSUtil.sendSMS(
|
|
|
|
|
+ checker.getPhone(),
|
|
|
|
|
+ tempCode,
|
|
|
|
|
+ Constant.SINGNAMW,
|
|
|
|
|
+ JSONObject.toJSONString(params)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ // wangjiang@2022-10-09 20:54:48 发送给魏培培通知所有审查通过
|
|
|
|
|
+ if (stockLandService.isNeedNoticeAfterDispatch(stockLand.getApply_type())) {
|
|
|
|
|
+ AlibabaSMSUtil.sendSMS(
|
|
|
|
|
+ companyMasterPhone,
|
|
|
|
|
+ Constant.SMS_TemplateCode.STOCKLAND_JUDGE_FINISH_DISPATCH,
|
|
|
|
|
+ Constant.SINGNAMW,
|
|
|
|
|
+ JSONObject.toJSONString(params)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ stockLandService.autoSaveApproval(stockLand.getId(),
|
|
|
|
|
+ "超时自动审批通过",
|
|
|
|
|
+ currentChecker,
|
|
|
|
|
+ String.join(",", checkers) + ",",
|
|
|
|
|
+ stockLand.getApprove_status(),
|
|
|
|
|
+ stockLand.getApprove_status(),
|
|
|
|
|
+ Constant.OperType.SUBMIT_COMMENT,
|
|
|
|
|
+ latestApproval.getApproval_round());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|