Prechádzať zdrojové kódy

Merge branch 'develop' of http://132.232.206.88:3000/lift-manager/lift-server into wanghaicheng

wanghaicheng 5 rokov pred
rodič
commit
09b32bea94

+ 3 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/capital/service/SignInService.java

@@ -65,9 +65,9 @@ public class SignInService extends ServiceImpl<SignInMapper, SignIn> {
      * @date 2020/4/20 9:29 下午
      */
     public RestResponse signIn(CapitalRepairRequest request) {
-        boolean ret = VerifyUtils.preJudgment(request.getCoordinate());
-        if (!ret)
-            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
+//        boolean ret = VerifyUtils.preJudgment(request.getCoordinate());
+//        if (!ret)
+//            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
         SignIn oldSignIn = getOne(request.getMtCompanyId(), request.getProjectId(), request.getUserId());
         if (ObjectUtil.isNotEmpty(oldSignIn)) {
             String approachTime = oldSignIn.getApproachTime();

+ 13 - 13
lift-business-service/src/main/java/cn/com/ty/lift/business/common/CommonController.java

@@ -98,13 +98,13 @@ public class CommonController {
         for (MultipartFile file : files) {
             String currentTime = DateUtil.formatDateTime(new Date());
             //上传图片加图片水印
-            ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
+            //ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
             //上传图片加文字水印
-            ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
-            File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
-            FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
-            MultipartFile mfile = new CommonsMultipartFile(fileItem);
-            String fileName = handleFile(mfile);
+            //ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
+            //File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
+            //FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
+            //MultipartFile mfile = new CommonsMultipartFile(fileItem);
+            String fileName = handleFile(file);
             fileMap.put(fileName, file);
         }
         //2 批量上传
@@ -132,15 +132,15 @@ public class CommonController {
     @PostMapping("upload")
     public RestResponse upload(@RequestParam("file") MultipartFile file) {
         Validate.notTrue(Objects.isNull(file) || file.isEmpty(), ValuePool.UPLOAD_DATA_MISSING);
-        String currentTime = DateUtil.formatDateTime(new Date());
+        //String currentTime = DateUtil.formatDateTime(new Date());
         //上传图片加图片水印
-        ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
+        //ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
         //上传图片加文字水印
-        ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
-        File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
-        FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
-        MultipartFile mfile = new CommonsMultipartFile(fileItem);
-        String fileName = handleFile(mfile);
+        //ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
+        //File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
+        //FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
+        //MultipartFile mfile = new CommonsMultipartFile(fileItem);
+        String fileName = handleFile(file);
         try {
             String url = systemConfiguration.build().putObject(fileName, file.getBytes());
             log.info("upload file complete, file URL: {}", url);

+ 6 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -407,12 +407,12 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
         Optional<Lift> oldLift = getOne(null, lift.getId());
         if (!oldLift.isPresent())
             return RestResponse.fail(MessageUtils.get("msg.lift.not.exist"));
-        String coordinate = lift.getCoordinate();
-        if (Objects.nonNull(coordinate)) {
-            boolean ret = VerifyUtils.preJudgment(coordinate);
-            if (!ret)
-                return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
-        }
+//        String coordinate = lift.getCoordinate();
+//        if (Objects.nonNull(coordinate)) {
+//            boolean ret = VerifyUtils.preJudgment(coordinate);
+//            if (!ret)
+//                return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
+//        }
         LocalDate lastDay = lift.getAnnualInspectionDate().with(TemporalAdjusters.lastDayOfMonth());
         lift.setAnnualInspectionDate(lastDay);
         boolean result = updateById(lift);

+ 36 - 10
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/MaintenanceRecordController.java

@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.google.common.base.Splitter;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -50,14 +51,14 @@ import java.util.stream.Collectors;
 @RequestMapping("maintenance/record")
 public class MaintenanceRecordController {
 
-    private MaintenancePlanService      maintenancePlanService;
-    private MaintenanceRecordService    maintenanceRecordService;
-    private MtRecordCostService         mtRecordCostService;
-    private MtRecordImgService          mtRecordImgService;
-    private MaintenanceOptionService    maintenanceOptionService;
+    private MaintenancePlanService maintenancePlanService;
+    private MaintenanceRecordService maintenanceRecordService;
+    private MtRecordCostService mtRecordCostService;
+    private MtRecordImgService mtRecordImgService;
+    private MaintenanceOptionService maintenanceOptionService;
     private ProjectLiftRelevanceService projectLiftRelevanceService;
-    private EvaluationService           evaluationService;
-    private MaintenanceRecordMapper     maintenanceRecordMapper;
+    private EvaluationService evaluationService;
+    private MaintenanceRecordMapper maintenanceRecordMapper;
 
     /**
      * 根据条件分页查询维保-日常保养
@@ -71,7 +72,7 @@ public class MaintenanceRecordController {
         //保养单: 按照执行日期由近及远排序
         LocalDate planBegin = request.getPlanBegin();
         LocalDate planEnd = request.getPlanEnd();
-        if(Objects.nonNull(planBegin) && Objects.nonNull(planEnd)){
+        if (Objects.nonNull(planBegin) && Objects.nonNull(planEnd)) {
             Validate.isTrue(planBegin.isBefore(planEnd), ValuePool.beginTimeToEndTimeIllegal(planBegin, planEnd));
         }
         request.addDesc("work_date");
@@ -92,7 +93,7 @@ public class MaintenanceRecordController {
         //计划超期:按计划保养时间由近及远排序
         LocalDate planBegin = request.getPlanBegin();
         LocalDate planEnd = request.getPlanEnd();
-        if(Objects.nonNull(planBegin) && Objects.nonNull(planEnd)){
+        if (Objects.nonNull(planBegin) && Objects.nonNull(planEnd)) {
             Validate.isTrue(planBegin.isBefore(planEnd), ValuePool.beginTimeToEndTimeIllegal(planBegin, planEnd));
         }
         request.addDesc("plan_date");
@@ -140,6 +141,31 @@ public class MaintenanceRecordController {
     @PostMapping("one")
     @Validation(fields = {"id"})
     public RestResponse one(@Val @RequestBody MtRecordRequest request) {
+        MtRecordResponse entity = getMtRecordResponse(request);
+        return RestResponse.success(entity);
+    }
+
+    /**
+     * @param request 保养单id
+     * @return
+     * @description 获取多条保养单
+     * @date 2020/5/21 5:14 下午
+     */
+    @PostMapping("many")
+    public RestResponse many(@RequestBody MtRecordRequest request) {
+        List<MtRecordResponse> mtRecordResponseList = new ArrayList<>();
+        if (StringUtils.isNotBlank(request.getRecordIds())) {
+            String[] recordIdArray = request.getRecordIds().split(",");
+            for (String recordIdStr : recordIdArray) {
+                long recordId = Long.parseLong(recordIdStr);
+                request.setId(recordId);
+                mtRecordResponseList.add(getMtRecordResponse(request));
+            }
+        }
+        return RestResponse.success(mtRecordResponseList);
+    }
+
+    private MtRecordResponse getMtRecordResponse(@RequestBody @Val MtRecordRequest request) {
         MtRecordResponse entity = maintenanceRecordService.infoById(request);
         Validate.notNull(entity, ValuePool.MAINTENANCE_RECORD_NOT_EXIST);
         /**
@@ -166,7 +192,7 @@ public class MaintenanceRecordController {
         entity.setMtRecordImgs(mtRecordImgService.listByRecord(id));
         //评价
         entity.setEvaluation(evaluationService.findByRecord(id, ValuePool.EVALUATE_SOURCE_MAINTENANCE));
-        return RestResponse.success(entity);
+        return entity;
     }
 
     /**

+ 5 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/request/MtRecordRequest.java

@@ -85,4 +85,9 @@ public class MtRecordRequest extends PageRequest {
      */
     @Min(value = 1, message = "维保记录收费项ID有误")
     private Long mtRecordCostId;
+
+    /**
+     * 维保记录id集合
+     */
+    private String recordIds;
 }

+ 2 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/mapper/MaintenanceRecordMapper.java

@@ -66,6 +66,8 @@ public interface MaintenanceRecordMapper extends BaseMapper<MaintenanceRecord> {
 
     MtRecordResponse infoById(@Param("cond") MtRecordRequest request);
 
+    List<MtRecordResponse> listByIds(MtRecordRequest request);
+
     IPage<MtRecordResponse> pageByLift(IPage<MtRecordResponse> page, @Param("cond") MtRecordRequest request);
 
     @Select("SELECT id FROM maintenance_record WHERE mt_plan_id = #{planId}")

+ 12 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java

@@ -194,9 +194,9 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
             return RestResponse.fail(MessageUtils.get("msg.exist.record"));
         String coordinate = request.getCoordinate();
         //校验是否为经纬度
-        boolean verifyResult = VerifyUtils.preJudgment(coordinate);
-        if (!verifyResult)
-            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
+//        boolean verifyResult = VerifyUtils.preJudgment(coordinate);
+//        if (!verifyResult)
+//            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
         //维保工是否在电梯附近
         boolean result = calc(liftCoordinate, coordinate);
         if (result)
@@ -343,6 +343,15 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
         return baseMapper.infoById(request);
     }
 
+    /**
+     * 批量打印
+     * @param request
+     * @return
+     */
+    public List<MtRecordResponse> listByIds(MtRecordRequest request) {
+        return baseMapper.listByIds(request);
+    }
+
     private void rollback() {
         //强制手动事务回滚
         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceService.java

@@ -33,6 +33,6 @@ public class MaintenanceService {
         int limitedNum = company.getLimitedNum();
         //获取该公司企业电梯关联表的实际电梯台量
         int currentNum = platformService.countLiftNum(mtCompanyId);
-        return currentNum >= limitedNum;
+        return limitedNum >= currentNum;
     }
 }

+ 31 - 6
lift-business-service/src/main/resources/mapper/maintenance/MaintenanceRecordMapper.xml

@@ -100,7 +100,7 @@
 	<!--app端 保养任务列表 (1:保养中、2:已完成) -->
 	<select id="findRecordByWorkerId" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceAppResponse"
 			parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest">
-		SELECT p.project_name AS projectName,
+		SELECT DISTINCT p.project_name AS projectName,
 			p.id                AS projectId,
 			mr.id               AS mtPlanId,
 			mr.id               AS recordId,
@@ -224,7 +224,7 @@
         LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
         LEFT JOIN project pr ON mr.project_id = pr.id AND pr.mt_company_id = mr.mt_company_id
         LEFT JOIN evaluation ev ON mr.id = ev.record_id
-        <where>
+        WHERE ((status = '2' AND has_evaluate = '0') or (status = '2' AND has_evaluate = '1'))
             <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
                 AND mr.mt_company_id = #{cond.mtCompanyId}
             </if>
@@ -246,21 +246,19 @@
             <if test="cond.workDate != null">
                 AND mr.work_date = #{cond.workDate}
             </if>
-        </where>
     </select>
 
     <!--日常保养-保养单:根据条件汇总条数-->
     <select id="countRecordByCondition" resultType="java.lang.Long"
             parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
         SELECT
-        count(*)
+        count(1)
         FROM
         maintenance_record mr
-        <where>
+        WHERE  ((status = '2' AND has_evaluate = '0') or (status = '2' AND has_evaluate = '1'))
             <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
                 AND mr.mt_company_id = #{cond.mtCompanyId}
             </if>
-        </where>
     </select>
 
     <!--日常保养-保养单:根据id查询,带关联信息-->
@@ -290,6 +288,33 @@
         </where>
     </select>
 
+    <!--日常保养-保养单:根据ids查询,带关联信息-->
+    <select id="listByIds" resultMap="BaseResultMap"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
+        SELECT
+        mr.*,
+        li.use_company_code,
+        li.registration_code,
+        li.category,
+        mc.name AS mt_company_name,
+        ui.`name` AS worker_name,
+        pr.project_name,
+        pr.project_code,
+        ev.star_level
+        FROM
+        maintenance_record mr
+        LEFT JOIN lift li ON mr.lift_id = li.id
+        LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
+        LEFT JOIN project pr ON mr.project_id = pr.id AND mr.mt_company_id = pr.mt_company_id
+        LEFT JOIN evaluation ev ON mr.id = ev.record_id AND ev.source = 1
+        LEFT JOIN maintenance_company mc ON mr.mt_company_id = mc.id
+        <where>
+            <if test="cond.id != null and cond.id > 0">
+                mr.id = #{cond.id}
+            </if>
+        </where>
+    </select>
+
     <select id="pageByLift" resultMap="BaseResultMap"
             parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
         SELECT

+ 1 - 1
lift-business-service/src/main/resources/mapper/project/ProjectMapper.xml

@@ -166,7 +166,7 @@
 		p.actual_num    AS actualNum,
 		p.project_status AS projectStatus
 		FROM project p
-		WHERE 1=1
+		WHERE project_status != '3'
 		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
 			AND p.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
 		</if>

+ 0 - 2
lift-common/src/main/java/cn.com.ty.lift.common/constants/CommonEnum.java

@@ -148,8 +148,6 @@ public class CommonEnum {
      * 项目状态
      */
     public enum ProjectStatus implements IEnum {
-
-        DELETE("删除", "0"),
         NOT_START("尚未开始", "1"),
         IN_SERVICE("服务中", "2"),
         STOP_SERVICE("停止服务", "3"),

+ 4 - 4
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java

@@ -185,10 +185,10 @@ public class AttendanceController {
      */
     @PostMapping("clock")
     public RestResponse clock(@Valid @RequestBody Attendance entity) {
-        String coordinate = entity.getCoordinate();
-        boolean ret = VerifyUtils.preJudgment(coordinate);
-        if (!ret)
-            return RestResponse.fail("请输入正确的经纬度");
+//        String coordinate = entity.getCoordinate();
+//        boolean ret = VerifyUtils.preJudgment(coordinate);
+//        if (!ret)
+//            return RestResponse.fail("请输入正确的经纬度");
         Long mtCompanyId = entity.getMtCompanyId();
         Long userId = entity.getUserId();
         Integer type = entity.getType();