Explorar o código

项目申报退回没有手机号问题

huZhiHao %!s(int64=5) %!d(string=hai) anos
pai
achega
d8617048b9

+ 5 - 5
src/main/java/platform/modules/company/service/ProjectApplicationApproveService.java

@@ -237,7 +237,7 @@ public class ProjectApplicationApproveService extends BaseService<ProjectApplica
         } else if (Objects.equals("0", type)) {
             paramApplication.setProjectIds(getProjectIdsy());
         } else if (Objects.equals("2", type)) {
-            if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)){
+            if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
                 paramApplication.setStreet_id(ShiroUtils.getStreetId() + "");
             }
             paramApplication.setProjectIds(getProjectIdsc());
@@ -245,7 +245,7 @@ public class ProjectApplicationApproveService extends BaseService<ProjectApplica
 
         String year = paramApplication.getProject_year();
         if (year != null && !year.equals("")) {
-            paramApplication.setProject_year_date(year+"-01-01 00:00:00");
+            paramApplication.setProject_year_date(year + "-01-01 00:00:00");
         }
 
         PageHelper.startPage(pageNum, pageSize);
@@ -307,7 +307,7 @@ public class ProjectApplicationApproveService extends BaseService<ProjectApplica
             if (null != apply) {
                 //短信所需参数
                 Map<String, String> params = new HashMap<>();
-                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
+                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id(), approval.getApply_id(), Constant.DictionaryType.PROJECT_APPLICATION);
                 params.put("project_no", apply.getApply_no());
                 params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
 
@@ -335,7 +335,7 @@ public class ProjectApplicationApproveService extends BaseService<ProjectApplica
                                 companyAdmin.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
 //                        projectDeclarationService.sendProjectSMSToCompany(ShiroUtils.getUserEntity().getStreet_name(), apply, Constant.OperType.NOTAPPROVED);
                     } catch (ClientException | InterruptedException e) {
-                        throw new BaseException("短信接口异常!发送短信失败!");
+//                        throw new BaseException("短信接口异常!发送短信失败!");
                     }
 
                 } else if (approval.getStatus().equals(Constant.ApproveButtonStatus.REJECT)) {
@@ -352,7 +352,7 @@ public class ProjectApplicationApproveService extends BaseService<ProjectApplica
                                 companyAdmin.getPhone(), tempCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
 //                        projectDeclarationService.sendProjectSMSToCompany(ShiroUtils.getUserEntity().getStreet_name(), apply, Constant.OperType.REJECT);
                     } catch (ClientException | InterruptedException e) {
-                        throw new BaseException("短信接口异常!发送短信失败!");
+//                        throw new BaseException("短信接口异常!发送短信失败!");
                     }
 
                 }

+ 2 - 2
src/main/java/platform/modules/company/service/ProjectFillingService.java

@@ -340,7 +340,7 @@ public class ProjectFillingService extends BaseService<ProjectFilling> {
             params.put("apply_name", Constant.ProjectType.PROJECT_FILLING);
             String templateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
             String paramStr = JSONObject.toJSONString(params);
-            User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
+            User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id(), apply.getId(), Constant.DictionaryType.PROJECT_FILLING);
             AlibabaSMSUtil.sendSMS(
                     companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, paramStr);
         }
@@ -415,7 +415,7 @@ public class ProjectFillingService extends BaseService<ProjectFilling> {
                 params.put("apply_name", Constant.ProjectType.PROJECT_FILLING);
                 String templateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
                 String paramStr = JSONObject.toJSONString(params);
-                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
+                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id(), apply.getId(), Constant.DictionaryType.PROJECT_FILLING);
                 AlibabaSMSUtil.sendSMS(
                         companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, paramStr);
             }

+ 3 - 3
src/main/java/platform/modules/company/service/ProjectIntelligentService.java

@@ -208,7 +208,7 @@ public class ProjectIntelligentService extends BaseService<ProjectIntelligent> {
                 params.put("apply_name", Constant.ProjectType.PROJECT_INTELLIGENT);
                 String templateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
                 String paramStr = JSONObject.toJSONString(params);
-                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
+                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id(), apply.getId(), Constant.DictionaryType.PROJECT_INTELLIGENT);
                 AlibabaSMSUtil.sendSMS(
                         companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, paramStr);
             }
@@ -300,12 +300,12 @@ public class ProjectIntelligentService extends BaseService<ProjectIntelligent> {
                 params.put("apply_name", Constant.ProjectType.PROJECT_INTELLIGENT);
                 String templateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
                 String paramStr = JSONObject.toJSONString(params);
-                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
+                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id(), apply.getId(), Constant.DictionaryType.PROJECT_INTELLIGENT);
                 AlibabaSMSUtil.sendSMS(
                         companyAdmin.getPhone(), templateCode, Constant.SINGNAMW, paramStr);
             }
         }
-       return ResponseMessage.success("保存成功! 请到 企业后台--政务服务--项目申报--区级智能制造 查看");
+        return ResponseMessage.success("保存成功! 请到 企业后台--政务服务--项目申报--区级智能制造 查看");
     }
 
     //根据id获取项目填报信息

+ 2 - 2
src/main/java/platform/modules/company/service/ProjectMattersService.java

@@ -339,7 +339,7 @@ public class ProjectMattersService extends BaseService<ProjectMatters> {
                 params.put("apply_name", Constant.ProjectType.PROJECT_MATTERS);
                 String tempateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
                 String paramStr = JSONObject.toJSONString(params);
-                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
+                User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id(), apply.getId(), Constant.DictionaryType.PROJECT_MATTERS);
                 AlibabaSMSUtil.sendSMS(
                         companyAdmin.getPhone(), tempateCode, Constant.SINGNAMW, paramStr);
             }
@@ -437,7 +437,7 @@ public class ProjectMattersService extends BaseService<ProjectMatters> {
             params.put("apply_name", Constant.ProjectType.PROJECT_MATTERS);
             String tempateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
             String paramStr = JSONObject.toJSONString(params);
-            User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
+            User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id(), apply.getId(), Constant.DictionaryType.PROJECT_MATTERS);
             AlibabaSMSUtil.sendSMS(
                     companyAdmin.getPhone(), tempateCode, Constant.SINGNAMW, paramStr);
 

+ 5 - 5
src/main/java/platform/modules/government/service/ProjectDeclarationService.java

@@ -1050,7 +1050,7 @@ public class ProjectDeclarationService extends BaseService<ProjectDeclaration> {
         params.put("project_no", projectApplication.getApply_no());
         params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
         Company company = companyService.findById(projectApplication.getCompany_id());
-        User companyAdmin = userService.findCompanyAdmin(company.getId());
+        User companyAdmin = userService.findCompanyAdmin(company.getId(), projectId, Constant.DictionaryType.PROJECT_INTELLIGENT);
 
         if (Objects.equals(Constant.ProjectApplicationStatus.CENTRE_AUDIT, approval.getAfter_approvalstatus())) {
             //材料审核通过,进如处室(中心)审批
@@ -1391,7 +1391,7 @@ public class ProjectDeclarationService extends BaseService<ProjectDeclaration> {
         Map<String, String> params = new HashMap<>();
         params.put("project_no", projectApplication.getApply_no());
         Company company = companyService.findById(projectApplication.getCompany_id());
-        User companyAdmin = userService.findCompanyAdmin(company.getId());
+        User companyAdmin = userService.findCompanyAdmin(company.getId(), projectId, Constant.DictionaryType.PROJECT_INTELLIGENT);
 
         if (Objects.equals(Constant.ProjectApplicationStatus.CENTRE_AUDIT, approval.getAfter_approvalstatus())) {
             //材料审核通过,进如处室(中心)审批
@@ -1654,7 +1654,7 @@ public class ProjectDeclarationService extends BaseService<ProjectDeclaration> {
         params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
         String templateCode = Constant.SMS_TemplateCode.RPOJECT_MATTERS_REJECT;
         try {
-            User user = userService.findCompanyAdmin(projectApplication.getCompany_id());
+            User user = userService.findCompanyAdmin(projectApplication.getCompany_id(), projectId, Constant.DictionaryType.PROJECT_INTELLIGENT);
             AlibabaSMSUtil.sendSMS(
                     user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
         } catch (ClientException | InterruptedException e) {
@@ -1720,7 +1720,7 @@ public class ProjectDeclarationService extends BaseService<ProjectDeclaration> {
         params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);
         String templateCode = Constant.SMS_TemplateCode.RPOJECT_MATTERS_UNPASS;
         try {
-            User user = userService.findCompanyAdmin(projectApplication.getCompany_id());
+            User user = userService.findCompanyAdmin(projectApplication.getCompany_id(), projectId, Constant.DictionaryType.PROJECT_INTELLIGENT);
             AlibabaSMSUtil.sendSMS(
                     user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params));
         } catch (ClientException | InterruptedException e) {
@@ -1770,7 +1770,7 @@ public class ProjectDeclarationService extends BaseService<ProjectDeclaration> {
 
         //发送短信
         Map<String, String> params = new HashMap<>();
-        User companyAdmin = userService.findCompanyAdmin(company.getId());
+        User companyAdmin = userService.findCompanyAdmin(company.getId(), projectId, Constant.DictionaryType.PROJECT_INTELLIGENT);
         String tempCode = Constant.SMS_TemplateCode.REMINSD_COMPNAY_PRINT_MATERIALS;
         params.put("project_no", projectApplication.getApply_no());
         params.put("apply_name", Constant.ProjectType.PROJECT_APPLICATION);

+ 47 - 10
src/main/java/platform/modules/government/service/UserService.java

@@ -31,6 +31,8 @@ import platform.modules.build.service.CompanyService;
 import platform.modules.carrier.dto.ChangePassword;
 import platform.modules.carrier.entity.Park;
 import platform.modules.carrier.service.ParkService;
+import platform.modules.company.entity.ProjectApplicationCompanyInfo;
+import platform.modules.company.service.ProjectApplicationCompanyInfoService;
 import platform.modules.government.dao.AttachmentDao;
 import platform.modules.government.dao.UserDao;
 import platform.modules.government.entity.Attachment;
@@ -56,6 +58,7 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 用户管理(政府)Service
@@ -85,6 +88,7 @@ public class UserService extends BaseService<User> {
 
     @Autowired
     private UserGroupService userGroupService;
+
     @Autowired
     private StreetService streetService;
 
@@ -112,6 +116,9 @@ public class UserService extends BaseService<User> {
     @Autowired
     private RedisService redisService;
 
+    @Autowired
+    private ProjectApplicationCompanyInfoService projectApplicationCompanyInfoService;
+
     protected final transient Log log = LogFactory.get(this.getClass());
 
     public PageInfo<User> findPage(Integer pageNum, Integer pageSize, String param) throws Exception {
@@ -670,11 +677,42 @@ public class UserService extends BaseService<User> {
         user.setDel_flag(false);
         List<User> users = this.findListByWhere(user);
         if (users != null && users.size() > 0) {
-            return users.get(0);
+            for (User user1 : users) {
+                if (user1.getPhone() != null && user1.getPhone() != "") {
+                    return user1;
+                }
+            }
+//            return users.get(0);
         }
         return null;
     }
 
+    //查找企业管理员
+    public User findCompanyAdmin(Integer companyId, Integer applyId, String type) {
+        User user = new User();
+        user.setCompany_id(companyId);
+        user.setIs_admin(true);
+        user.setDel_flag(false);
+        List<User> users = this.findListByWhere(user);
+        boolean flag = true;
+        if (users != null && users.size() > 0) {
+            for (int i = users.size() - 1; i >= 0; i--) {
+                if (users.get(i) != null && users.get(i).getPhone() != null && !Objects.equals(users.get(i).getPhone(), "")) {
+                    flag = false;
+                    return users.get(i);
+                }
+            }
+            if (flag) {
+                ProjectApplicationCompanyInfo companyInfo = projectApplicationCompanyInfoService.findByApplyIdAndType(applyId, type);
+                if (companyInfo != null && companyInfo.getContact_phone() != null) {
+                    user = users.get(users.size() - 1);
+                    user.setPhone(companyInfo.getContact_phone());
+                }
+            }
+        }
+        return user;
+    }
+
     //删除企业账户,(例如:注册失败要删除企业账户)
     public void deleteCompanyUser(Integer id) {
         userDao.deleteCompanyUser(id);
@@ -844,7 +882,7 @@ public class UserService extends BaseService<User> {
     }
 
     /**
-     *  获取个人中心用户
+     * 获取个人中心用户
      *
      * @param id
      * @return
@@ -860,7 +898,7 @@ public class UserService extends BaseService<User> {
      * @param id
      * @return
      */
-    public String department(Unit user, Integer id){
+    public String department(Unit user, Integer id) {
         return user.departmentName(id);
     }
 
@@ -881,7 +919,7 @@ public class UserService extends BaseService<User> {
      * @return
      */
     public String getGovDepartment(User user) {
-        if (user.getDepartment_id() != null){
+        if (user.getDepartment_id() != null) {
             return departmentService.findById(user.getDepartment_id()).getName();
         }
         return null;
@@ -914,11 +952,13 @@ public class UserService extends BaseService<User> {
      */
     public ResponseMessage changePassword(ChangePassword changePassword) {
         User user = this.findById(changePassword.getUserId());
-        if ( user == null){ return ResponseMessage.error("用户不存在");}
-        if (!user.getPassword().equals(secureMD5(changePassword.getOldPass()))){
+        if (user == null) {
+            return ResponseMessage.error("用户不存在");
+        }
+        if (!user.getPassword().equals(secureMD5(changePassword.getOldPass()))) {
             return ResponseMessage.error("旧密码不正确");
         }
-        if (user.getPassword().equals(secureMD5(changePassword.getNewPass()))){
+        if (user.getPassword().equals(secureMD5(changePassword.getNewPass()))) {
             return ResponseMessage.error("新密码与旧密码相同");
         }
         user.setPassword(secureMD5(changePassword.getNewPass()));
@@ -927,7 +967,4 @@ public class UserService extends BaseService<User> {
     }
 
 
-
-
-
 }

+ 49 - 4
src/main/java/platform/modules/sys/task/Task.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.parser.Feature;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.alibaba.fastjson.support.config.FastJsonConfig;
 import com.google.gson.GsonBuilder;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Configurable;
@@ -15,23 +16,30 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import platform.common.Constant;
+import platform.common.base.model.Dict;
+import platform.common.util.CommonUtils;
 import platform.common.util.DateUtil;
 import platform.common.util.HttpClientUtil;
 import platform.modules.area.MapAreaService;
 import platform.modules.build.entity.BuildingInfo;
 import platform.modules.build.entity.Company;
 import platform.modules.build.service.*;
+import platform.modules.company.entity.ProjectApplication;
+import platform.modules.company.service.ProjectApplicationService;
 import platform.modules.government.dao.PolicyDao;
 import platform.modules.government.dto.PolicyDetailDto;
 import platform.modules.government.dto.PolicyDto;
 import platform.modules.government.entity.CompanyReport;
 import platform.modules.government.entity.Policy;
+import platform.modules.government.entity.Project;
 import platform.modules.government.service.CompanyReportService;
 import platform.modules.government.service.PolicyService;
+import platform.modules.government.service.ProjectService;
 import platform.modules.sys.entity.SysConfig;
 import platform.modules.sys.service.SysConfigService;
 import scriptella.execution.EtlExecutor;
 import scriptella.execution.EtlExecutorException;
+import tk.mybatis.mapper.entity.Example;
 
 import javax.annotation.Resource;
 import java.io.File;
@@ -39,10 +47,7 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 import java.util.concurrent.*;
 
 /**
@@ -253,4 +258,44 @@ public class Task {
             } //Execute etl.xml file
         }
     }
+
+
+    @Autowired
+    private ProjectApplicationService projectApplicationService;
+
+    @Autowired
+    private ProjectService projectService;
+
+    @Scheduled(cron = "0 0 22 * * ?")
+    public void CorrectApplicationType() throws Exception {
+
+        String year = DateUtil.getCurrentDateString("yyyy");
+        Example example = new Example(ProjectApplication.class);
+        Example.Criteria criteria = example.createCriteria();
+        criteria.andLike("apply_no", "%GY" + year + "%");
+        List<ProjectApplication> projectApplicationList = projectApplicationService.selectByExample(example);
+
+        example = new Example(Project.class);
+        criteria = example.createCriteria();
+        criteria.andEqualTo("project_year", year);
+        List<Project> projectList = projectService.selectByExample(example);
+
+        if (CommonUtils.isNotNull(projectApplicationList) && CommonUtils.isNotNull(projectList)) {
+            for (ProjectApplication projectApplication : projectApplicationList) {
+                for (Project project : projectList) {
+                    if (
+                            Objects.equals(projectApplication.getProject_name(), project.getProject_name())
+                                    && projectApplication.getProject_id() != project.getId()
+                    ) {
+//                        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+//                        System.out.println(projectApplication.toString());
+//                        System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
+                        projectApplication.setProject_id(project.getId());
+                        projectApplicationService.updateSelective(projectApplication);
+                        break;
+                    }
+                }
+            }
+        }
+    }
 }