Browse Source

Merge branch 'feature-bieao' of lift-manager/lift-server into develop

bieao 5 năm trước cách đây
mục cha
commit
df2c6b02bf

+ 2 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/capital/dao/entity/SignIn.java

@@ -63,11 +63,11 @@ public class SignIn extends BaseEntity {
     /**
      * 进场时间
      */
-    private LocalTime approachTime;
+    private String approachTime;
 
     /**
      * 离场时间
      */
-    private LocalTime leavingTime;
+    private String leavingTime;
 
 }

+ 8 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/capital/dao/entity/model/response/SignRecord.java

@@ -3,7 +3,6 @@ package cn.com.ty.lift.business.capital.dao.entity.model.response;
 import lombok.Data;
 
 import java.time.LocalDate;
-import java.time.LocalTime;
 
 /**
  * @author bieao
@@ -12,6 +11,12 @@ import java.time.LocalTime;
  */
 @Data
 public class SignRecord {
+
+    public SignRecord() {
+        this.approachTime = "--";
+        this.leavingTime = "--";
+    }
+
     /**
      * 签到时间
      */
@@ -19,11 +24,11 @@ public class SignRecord {
     /**
      * 进场时间
      */
-    private LocalTime approachTime;
+    private String approachTime;
     /**
      * 离场时间
      */
-    private LocalTime leavingTime;
+    private String leavingTime;
     /**
      * 用户姓名
      */

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/capital/service/CapitalRepairService.java

@@ -77,7 +77,7 @@ public class CapitalRepairService extends ServiceImpl<CapitalRepairMapper, Capit
         totalMap.put("complete", complete == null ? 0 : complete);
         int projectCount = count(mtCompanyId, projectStatus);
         int liftCount = capitalRepairLiftRelevanceService.count(mtCompanyId, projectStatus);
-        int stopLiftCount = platformCompanyService.count(mtCompanyId, projectStatus);
+        int stopLiftCount = platformCompanyService.countCapital(mtCompanyId, projectStatus);
         Map<String, Object> resultMap = new HashMap<>();
         resultMap.put("totalCount", totalMap);
         resultMap.put("projectCount", projectCount);

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

@@ -67,17 +67,17 @@ public class SignInService extends ServiceImpl<SignInMapper, SignIn> {
     public RestResponse signIn(SignIn entry) {
         SignIn signIn = getOne(entry.getMtCompanyId(), entry.getProjectId(), entry.getUserId());
         if (ObjectUtil.isNotEmpty(signIn)) {
-            LocalTime approachTime = signIn.getApproachTime();
-            LocalTime leavingTime = signIn.getLeavingTime();
+            String approachTime = signIn.getApproachTime();
+            String leavingTime = signIn.getLeavingTime();
             if (approachTime != null && leavingTime != null) {
                 //今日已签到
                 return RestResponse.success(null, MessageUtils.get("msg.sign.limit"));
             }
-            signIn.setLeavingTime(LocalTime.now());
+            signIn.setLeavingTime(LocalTime.now().toString());
             saveOrUpdate(signIn);
         } else {
             entry.setSignDate(LocalDate.now());
-            entry.setApproachTime(LocalTime.now());
+            entry.setApproachTime(LocalTime.now().toString());
             save(entry);
         }
         return  RestResponse.success(null, MessageUtils.get("msg.sign.success"));
@@ -166,14 +166,26 @@ public class SignInService extends ServiceImpl<SignInMapper, SignIn> {
         paramMap.put("projectId", request.getId());
         paramMap.put("userId", request.getUserId());
         //查询签到记录
-        List<SignRecord> signRecord = baseMapper.findByCondition(paramMap);
+        List<SignRecord> signRecordList = baseMapper.findByCondition(paramMap);
         List<SignRecordGroupResult> results = new ArrayList<>();
+        List<String> userNames = signRecordList.stream().map(SignRecord::getUserName).distinct().collect(Collectors.toList());
         //分组签到记录
-        Map<LocalDate, List<SignRecord>> collect = signRecord.stream().collect(Collectors.groupingBy(SignRecord::getSignDate));
-        for (Map.Entry<LocalDate, List<SignRecord>> entry : collect.entrySet()) {
+        Map<LocalDate, List<SignRecord>> signRecordMap = signRecordList.stream().collect(Collectors.groupingBy(SignRecord::getSignDate));
+        for (Map.Entry<LocalDate, List<SignRecord>> entry : signRecordMap.entrySet()) {
+            LocalDate signDate = entry.getKey();
+            List<SignRecord> signRecords = entry.getValue();
+            for (String name : userNames) {
+                Optional<SignRecord> first = signRecords.stream().filter(sign -> Objects.equals(name, sign.getUserName())).findFirst();
+                if (!first.isPresent()) {
+                    SignRecord record = new SignRecord();
+                    record.setUserName(name);
+                    record.setSignDate(signDate);
+                    signRecords.add(record);
+                }
+            }
             SignRecordGroupResult result = new SignRecordGroupResult();
-            result.setSignDate(entry.getKey());
-            result.setSignRecords(entry.getValue());
+            result.setSignDate(signDate);
+            result.setSignRecords(signRecords);
             results.add(result);
         }
         results.sort(Comparator.comparing(SignRecordGroupResult::getSignDate).reversed());

+ 7 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/service/ContractService.java

@@ -183,11 +183,13 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
             return RestResponse.fail(MessageUtils.get("msg.modify.fail"));
         }
 
-        //修改付款信息
-        boolean paymentResult = paymentService.modifyBatchById(extend.getPaymentList());
-        if (!paymentResult) {
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return RestResponse.fail(MessageUtils.get("msg.modify.fail"));
+        if (CollUtil.isNotEmpty(paymentList)){
+            //修改付款信息
+            boolean paymentResult = paymentService.modifyBatchById(paymentList);
+            if (!paymentResult) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return RestResponse.fail(MessageUtils.get("msg.modify.fail"));
+            }
         }
         return RestResponse.success(null, MessageUtils.get("msg.modify.success"));
     }

+ 3 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/mapper/PlatformCompanyLiftRelevanceMapper.java

@@ -12,4 +12,7 @@ import org.apache.ibatis.annotations.Param;
 public interface PlatformCompanyLiftRelevanceMapper extends BaseMapper<PlatformCompanyLiftRelevance> {
 
     int count(@Param("mtCompanyId") Long mtCompanyId, @Param("projectStatus") String projectStatus);
+
+    int countCapital(@Param("mtCompanyId") Long mtCompanyId, @Param("projectStatus") String projectStatus);
+
 }

+ 11 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/PlatformCompanyLiftRelevanceService.java

@@ -95,6 +95,17 @@ public class PlatformCompanyLiftRelevanceService extends ServiceImpl<PlatformCom
         return baseMapper.count(mtCompanyId, projectStatus);
     }
 
+    /**
+     * @param mtCompanyId   公司id
+     * @param projectStatus 项目状态
+     * @return 条数
+     * @description 根据公司id和项目状态查询停保电梯
+     * @date 2020/4/24 9:50 上午
+     */
+    public int countCapital(Long mtCompanyId, String projectStatus) {
+        return baseMapper.countCapital(mtCompanyId, projectStatus);
+    }
+
     /**
      * @param id 主键id
      * @return 是否成功

+ 10 - 0
lift-business-service/src/main/resources/mapper/lift/PlatformCompanyLiftRelevanceMapper.xml

@@ -17,4 +17,14 @@
 		  AND p.project_status = #{projectStatus}
 		  AND lift_company_status = '1'
 	</select>
+
+	<select id="countCapital" resultType="java.lang.Integer">
+		SELECT count(1)
+		FROM platform_company_lift_relevance pclr
+				 LEFT JOIN capital_repair_lift_relevance crlr ON pclr.lift_id = crlr.lift_id
+				 LEFT JOIN capital_repair cr ON crlr.project_id = cr.id
+		WHERE pclr.mt_company_id = #{mtCompanyId}
+		  AND cr.project_status = #{projectStatus}
+		  AND lift_company_status = '1'
+	</select>
 </mapper>