gongdecai 3 vuotta sitten
vanhempi
commit
e2260ea722

+ 60 - 53
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranSettlementReportServiceImpl.java

@@ -36,11 +36,11 @@ import java.util.stream.Collectors;
 @Service
 public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementReportMapper, TranSettlementReport> implements ITranSettlementReportService {
 
-//    @Autowired
-//    private INewWorkflowService workflowService;
+    @Autowired
+    private INewWorkflowService workflowService;
 
-//    @SofaReference
-//    private ICommonRoleResourceService roleResourceService;
+    @SofaReference
+    private ICommonRoleResourceService roleResourceService;
     @Autowired
     private IDriverPayeeInfoService driverPayeeInfoService;
     @Autowired
@@ -48,6 +48,7 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
 
     @Autowired
     private IContractManagementInfoService contractManagementInfoService;
+
     /**
      * 汽运结算统计列表
      *
@@ -59,16 +60,16 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
         Map<String, Object> pageView = new HashMap<>();
         pageView.put("startRecord", (tranSettlementReport.getCurrentPage() - 1)
                 * tranSettlementReport.getPageSize());
-//        List<String> businessKeys = null;
-//        if("1".equals(tranSettlementReport.getSearchType())){
-//            businessKeys = workflowService.getTaskBusinessKeysByCode("PROCUREMENT-CLOSE-REPORT");
-//        }
-//        List<String> statusSet = new ArrayList<>();
-//        List<String> resourceIdList = this.getResourceIdList();
-//        if (resourceIdList.contains("procurementCloseReport-Edit")) { // 填写,提交    权限做完以后替换
-//            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
-//            statusSet.addAll(statusList);
-//        }
+        List<String> businessKeys = null;
+        if ("1".equals(tranSettlementReport.getSearchType())) {
+            businessKeys = workflowService.getTaskBusinessKeysByCode("TRANSPORTATION-SETTLEMENT-REPORT");
+        }
+        List<String> statusSet = new ArrayList<>();
+        List<String> resourceIdList = this.getResourceIdList();
+        if (resourceIdList.contains("transportationReport-Edit")) { // 填写,提交    权限做完以后替换
+            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
+            statusSet.addAll(statusList);
+        }
 
         //公司id
         pageView.put("compId", tranSettlementReport.getCompId());
@@ -77,10 +78,10 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
         pageView.put("pageSize", tranSettlementReport.getPageSize());
         pageView.put("currentPage", tranSettlementReport.getCurrentPage());
         pageView.put("contractNo", tranSettlementReport.getContractNo());
-//        pageView.put("roleFlag", tranSettlementReport.getRoleFlag());
+        pageView.put("roleFlag", tranSettlementReport.getRoleFlag());
         pageView.put("statusFlag", tranSettlementReport.getStatusFlag());
-//        pageView.put("businessKeys", businessKeys);
-//        pageView.put("statusSet", statusSet);
+        pageView.put("businessKeys", businessKeys);
+        pageView.put("statusSet", statusSet);
 
 
         // 查询汽运信息总数
@@ -93,40 +94,45 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
                 List<DriverViewInfo> driverViewInfoList = driverViewInfoService.selectList(new EntityWrapper<DriverViewInfo>()
                         .eq("driver_name", tranSettlementReport1.getName())
                         .eq("delete_flag", "0"));
-                if (!CollectionUtils.isEmpty(driverViewInfoList)){
-                    for (DriverViewInfo driverViewInfo:driverViewInfoList){
-                        List<DriverPayeeInfo> driverPayeeInfoList=driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
+                if (!CollectionUtils.isEmpty(driverViewInfoList)) {
+                    for (DriverViewInfo driverViewInfo : driverViewInfoList) {
+                        List<DriverPayeeInfo> driverPayeeInfoList = driverPayeeInfoService.selectList(new EntityWrapper<DriverPayeeInfo>()
                                 .eq("driver_id", driverViewInfo.getId())
                                 .eq("delete_flag", "0"));
                         tranSettlementReport1.setDriverPayeeInfoList(driverPayeeInfoList);
+
                     }
                 }
+                String taskId = "";
+                // 只有待审核状态才有taskId
+                if (StringUtils.isNotBlank(tranSettlementReport1.getWorkflowId())) {
+                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(tranSettlementReport1.getWorkflowId()), tranSettlementReport1.getId());
+                    taskId = jsonObject.getString("taskId");
+                    tranSettlementReport1.setTaskId(taskId);
+                }
             }
-//                String taskId = "";
-//                // 只有待审核状态才有taskId
-//                if (StringUtils.isNotBlank(tranSettlementReport1.getWorkflowId())) {
-//                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(tranSettlementReport1.getWorkflowId()), tranSettlementReport1.getId());
-//                    taskId = jsonObject.getString("taskId");
-//                    tranSettlementReport1.setTaskId(taskId);
-//                }
-//            }
+
         }
-                Page<TranSettlementReport> page = new Page<>();
-                page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
-                page.setTotal(dataCount == null ? 0 : dataCount);
-                page.setCurrent(tranSettlementReport.getCurrentPage());
-                page.setSize(tranSettlementReport.getPageSize());
-                return page;
+        Page<TranSettlementReport> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(tranSettlementReport.getCurrentPage());
+        page.setSize(tranSettlementReport.getPageSize());
+        return page;
     }
-//    private List<String> getResourceIdList() {
-//        User currentUser = AuthSecurityUtils.getCurrentUserInfo();
-//        // 当前登录人主要角色
-//        return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
-//                .map(CommonRoleResource::getResourceId).collect(Collectors.toList());
-//
-//    }
+
+
+    private List<String> getResourceIdList() {
+        User currentUser = AuthSecurityUtils.getCurrentUserInfo();
+        // 当前登录人主要角色
+        return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
+                .map(CommonRoleResource::getResourceId).collect(Collectors.toList());
+
+    }
+
     /**
      * 修改结算重量0修改扣款1修改已开发票2设置本次账户3
+     *
      * @param tranSettlementReport
      * @return
      */
@@ -134,26 +140,26 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
     public String editTranSettlementReport(TranSettlementReport tranSettlementReport) {
         //查询汽运结算信息
         TranSettlementReport tranSettlementReport1 = this.selectById(tranSettlementReport.getId());
-        if (tranSettlementReport1 != null ){
+        if (tranSettlementReport1 != null) {
             //0 修改结算重量
-            if(tranSettlementReport.getFlag()==0) {
+            if (tranSettlementReport.getFlag() == 0) {
                 tranSettlementReport1.setSettlementWeight(tranSettlementReport.getSettlementWeight());
                 tranSettlementReport1.setManualFlag("1");
                 //应付=单价x结算重量-扣款
-                tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice()*tranSettlementReport.getSettlementWeight()-Float.valueOf(tranSettlementReport1.getDeductionAmount()!=null?tranSettlementReport1.getDeductionAmount():"0"));
+                tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : "0"));
                 //更改汽运结算信息
                 this.updateById(tranSettlementReport1);
                 return "OK";
             }
             //1 修改扣款
-            else if(tranSettlementReport.getFlag()==1){
+            else if (tranSettlementReport.getFlag() == 1) {
                 tranSettlementReport1.setDeductionAmount(tranSettlementReport.getDeductionAmount());
                 //更改汽运结算信息
                 this.updateById(tranSettlementReport1);
                 return "OK";
             }
             //3 设置本次账户
-            else if(tranSettlementReport.getFlag()==3){
+            else if (tranSettlementReport.getFlag() == 3) {
                 tranSettlementReport1.setCardNo(tranSettlementReport.getCardNo());
                 //更改汽运结算信息
                 this.updateById(tranSettlementReport1);
@@ -169,8 +175,10 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
         }
         return "NG";
     }
+
     /**
      * 合同编号下拉列表
+     *
      * @param compId
      */
     @Override
@@ -181,21 +189,20 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
                 .eq("deliver_type", "1")
                 .eq("delete_flag", "0")
                 .orderBy("update_date", false));
-        for(ContractManagementInfo contractManagementInfo: contractManagementInfoList){
-            Float money=0.0f;
+        for (ContractManagementInfo contractManagementInfo : contractManagementInfoList) {
+            Float money = 0.0f;
             //查汽运结算报表
             List<TranSettlementReport> tranSettlementReportList = this.selectList(new EntityWrapper<TranSettlementReport>()
                     .eq("contract_no", contractManagementInfo.getContractNo())
                     .eq("delete_flag", "0"));
-            if (!CollectionUtils.isEmpty(tranSettlementReportList)){
-                for (TranSettlementReport tranSettlementReport:tranSettlementReportList){
-                    money=money+tranSettlementReport.getAmountNotPayable();
+            if (!CollectionUtils.isEmpty(tranSettlementReportList)) {
+                for (TranSettlementReport tranSettlementReport : tranSettlementReportList) {
+                    money = money + tranSettlementReport.getAmountNotPayable();
                 }
                 //有未付金额
                 if (money > 0) {
                     contractManagementInfo.setReportStatus("待结算");
-                }
-                else {
+                } else {
                     contractManagementInfo.setReportStatus("已结算");
                 }
             }

+ 4 - 4
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/SettledCompanyDynamicsMapper.xml

@@ -27,8 +27,8 @@
         <if test="pcFlag != null and pcFlag != ''and pcFlag != '1'">
             AND status_flag != '5'
         </if>
-        <if test="phone != null and phone != ''">
-            AND phone = #{phone}
+        <if test="loginPhone != null and loginPhone != ''">
+            AND phone = #{loginPhone}
         </if>
         <if test="showFlag != null and showFlag != ''">
             AND show_flag = #{showFlag}
@@ -71,8 +71,8 @@
         <if test="pcFlag != null and pcFlag != ''and pcFlag != '1'">
             AND status_flag != '5'
         </if>
-        <if test="phone != null and phone != ''">
-            AND phone = #{phone}
+        <if test="loginPhone != null and loginPhone != ''">
+            AND phone = #{loginPhone}
         </if>
         <if test="showFlag != null and showFlag != ''">
             AND show_flag = #{showFlag}

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/SettledCompanyInfoMapper.xml

@@ -165,7 +165,7 @@
         <if test="loginPhone != null and loginPhone != ''">
             AND b.phone = #{loginPhone}
         </if>
-        ORDER BY status_flag asc , b.update_date DESC
+        ORDER BY a.status_flag asc , a.update_date DESC
         <if test="currentPage != null and currentPage != ''">
             LIMIT ${startRecord}, ${pageSize}
         </if>

+ 34 - 34
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/TranSettlementReportMapper.xml

@@ -20,23 +20,23 @@
         <if test="contractNo != null and contractNo != ''and contractNo != '全部合同'">
             AND contract_no = #{contractNo}
         </if>
-<!--        <if test="businessKeys != null and businessKeys.size > 0">-->
-<!--            and(-->
-<!--            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">-->
-<!--                id = #{businessValue}-->
-<!--            </foreach>-->
-<!--            )-->
-<!--        </if>-->
-<!--        <if test="statusSet != null and statusSet.size > 0">-->
-<!--            or (-->
-<!--            <foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">-->
-<!--                status_flag =-->
-<!--                <if test="statusId != null">-->
-<!--                    #{statusId}-->
-<!--                </if>-->
-<!--            </foreach>-->
-<!--            )-->
-<!--        </if>-->
+        <if test="businessKeys != null and businessKeys.size > 0">
+            and(
+            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">
+                id = #{businessValue}
+            </foreach>
+            )
+        </if>
+        <if test="statusSet != null and statusSet.size > 0">
+            or (
+            <foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">
+                status_flag =
+                <if test="statusId != null">
+                    #{statusId}
+                </if>
+            </foreach>
+            )
+        </if>
     </select>
     <!-- 获得汽运结算统计列表 -->
     <select id="getListByCondition" parameterType="Map"
@@ -85,23 +85,23 @@
         <if test="contractNo != null and contractNo != ''and contractNo != '全部合同'">
             AND contract_no = #{contractNo}
         </if>
-<!--        <if test="businessKeys != null and businessKeys.size > 0">-->
-<!--            and(-->
-<!--            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">-->
-<!--                id = #{businessValue}-->
-<!--            </foreach>-->
-<!--            )-->
-<!--        </if>-->
-<!--        <if test="statusSet != null and statusSet.size > 0">-->
-<!--            or (-->
-<!--            <foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">-->
-<!--                status_flag =-->
-<!--                <if test="statusId != null">-->
-<!--                    #{statusId}-->
-<!--                </if>-->
-<!--            </foreach>-->
-<!--            )-->
-<!--        </if>-->
+        <if test="businessKeys != null and businessKeys.size > 0">
+            and(
+            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">
+                id = #{businessValue}
+            </foreach>
+            )
+        </if>
+        <if test="statusSet != null and statusSet.size > 0">
+            or (
+            <foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">
+                status_flag =
+                <if test="statusId != null">
+                    #{statusId}
+                </if>
+            </foreach>
+            )
+        </if>
         ORDER BY create_date DESC
         <if test="currentPage != null and currentPage != ''">
             LIMIT ${startRecord}, ${pageSize}