Quellcode durchsuchen

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

zx vor 1 Jahr
Ursprung
Commit
5966e6bea9

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/PlanController.java

@@ -81,7 +81,7 @@ public class PlanController {
     /*计划下产品工序组员分配*/
     @RequestMapping("/teamAllocation")
     @Transactional
-    public HttpRespMsg teamAllocation(PlanProcedureTotal planProcedureTotal, String teamIds){
+    public HttpRespMsg teamAllocation(PlanProcedureTotal planProcedureTotal, String teamIds) throws Exception {
         return planService.teamAllocation(planProcedureTotal,teamIds);
     }
 

+ 17 - 3
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Plan.java

@@ -5,11 +5,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.time.LocalDate;
 import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonInclude;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -21,12 +21,11 @@ import org.springframework.format.annotation.DateTimeFormat;
  * </p>
  *
  * @author Seyason
- * @since 2023-07-27
+ * @since 2023-07-29
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@JsonInclude(JsonInclude.Include.NON_NULL)
 public class Plan extends Model<Plan> {
 
     private static final long serialVersionUID=1L;
@@ -197,6 +196,21 @@ public class Plan extends Model<Plan> {
     @TableField(exist = false)
     private Product product;
 
+    @TableField(exist = false)
+    private double totalMoney;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    @TableField("create_id")
+    private String createId;
+
 
     @Override
     protected Serializable pkVal() {

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/PlanService.java

@@ -34,5 +34,5 @@ public interface PlanService extends IService<Plan> {
 
     HttpRespMsg hasSetDeptDetail();
 
-    HttpRespMsg teamAllocation(PlanProcedureTotal planProcedureTotal, String teamIds);
+    HttpRespMsg teamAllocation(PlanProcedureTotal planProcedureTotal, String teamIds) throws Exception;
 }

+ 33 - 4
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanServiceImpl.java

@@ -119,7 +119,7 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
         }
         /*作为工长看到的数据*/
         if(count(new QueryWrapper<Plan>().eq("foreman_id",user.getId()))>0){
-            queryWrapper.eq("foreman_id",user.getId());
+            queryWrapper.and(wrapper->wrapper.eq("foreman_id",user.getId()).or().eq("create_id",user.getId()));
         }else {
             /*作为组员可以查看的数据*/
             List<ProdProcedureTeam> prodProcedureTeams = prodProcedureTeamService.list(new QueryWrapper<ProdProcedureTeam>().eq("company_id", companyId).eq("user_id", user.getId()));
@@ -130,7 +130,8 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
                 collect = list.stream().map(PlanProcedureTotal::getPlanId).distinct().collect(Collectors.toList());
             }
             collect.add(-1);
-            queryWrapper.in("id",collect);
+            List<Integer> finalCollect = collect;
+            queryWrapper.and(wrapper->wrapper.in("id", finalCollect).or().eq("create_id",user.getId()));
         }
         if(!StringUtils.isEmpty(steelStampNumber)){
             queryWrapper.apply("'"+steelStampNumber+"'"+" between steel_stamp_number_start AND steel_stamp_number_end");
@@ -140,11 +141,21 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
         List<Integer> ids = records.stream().map(Plan::getProductId).distinct().collect(Collectors.toList());
         ids.add(-1);
         List<Product> productList = productMapper.selectList(new QueryWrapper<Product>().in("id", ids));
+        List<Integer> planIds = records.stream().map(Plan::getId).distinct().collect(Collectors.toList());
+        planIds.add(-1);
+        List<PlanProcedureTotal> procedureTotals = planProcedureTotalService.list(new QueryWrapper<PlanProcedureTotal>().in("plan_id", planIds));
         records.forEach(rs->{
             Optional<Product> first = productList.stream().filter(pl -> pl.getId().equals(rs.getProductId())).findFirst();
             if(first.isPresent()){
                 rs.setProduct(first.get());
             }
+            if(procedureTotals.size()>0){
+                List<PlanProcedureTotal> totals = procedureTotals.stream().filter(ps -> ps.getPlanId().equals(rs.getId())).collect(Collectors.toList());
+                if(totals.size()>0){
+                    double sum = totals.stream().mapToDouble(PlanProcedureTotal::getTotalWages).sum();
+                    rs.setTotalMoney(sum);
+                }
+            }
         });
         Map map=new HashMap();
         map.put("total",planIPage.getTotal());
@@ -155,9 +166,11 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
 
     @Override
     public HttpRespMsg addOrUpdatePlan(Plan plan) {
-        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        User user = userMapper.selectById(request.getHeader("token"));
+        Integer companyId = user.getCompanyId();
         HttpRespMsg msg=new HttpRespMsg();
         plan.setCompanyId(companyId);
+        plan.setCreateId(user.getId());
         if(plan.getStationId()!=null){
             Department department = departmentMapper.selectById(plan.getStationId());
             plan.setStationName(department.getDepartmentName());
@@ -637,13 +650,16 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
     }
 
     @Override
-    public HttpRespMsg teamAllocation(PlanProcedureTotal planProcedureTotal,String teamIds) {
+    public HttpRespMsg teamAllocation(PlanProcedureTotal planProcedureTotal,String teamIds) throws Exception {
         HttpRespMsg msg=new HttpRespMsg();
         Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
         BigDecimal totalWages=new BigDecimal(planProcedureTotal.getTotalWages());
         BigDecimal totalWorkingHours=new BigDecimal(planProcedureTotal.getTotalWorkingHours());
         BigDecimal overCountWages = new BigDecimal(0);
         BigDecimal overWorkingHours = new BigDecimal(0);
+        ProdProcedure prodProcedure = prodProcedureMapper.selectById(planProcedureTotal.getProdProcedureId());
+        Plan plan = planMapper.selectById(planProcedureTotal.getPlanId());
+        Product product = productMapper.selectById(plan.getProductId());
         List<ProdProcedureTeam> list=new ArrayList<>();
         if(!StringUtils.isEmpty(teamIds)){
             String[] team = teamIds.split(",");
@@ -652,6 +668,7 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
             overCountWages=totalWages.multiply(new BigDecimal(team.length));
             overWorkingHours=totalWorkingHours.multiply(new BigDecimal(team.length));
             List<ProdProcedureTeam> procedureTeamList = prodProcedureTeamService.list(new QueryWrapper<ProdProcedureTeam>().eq("plan_procedure_id",planProcedureTotal.getId()));
+            List<User> userList = userMapper.selectBatchIds(Arrays.asList(team));
             for (int i = 0; i < team.length; i++) {
                 ProdProcedureTeam prodProcedureTeam=new ProdProcedureTeam();
                 prodProcedureTeam.setCompanyId(companyId);
@@ -678,6 +695,18 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
                 }
                 list.add(prodProcedureTeam);
             }
+            List<WxCorpInfo> wxCorpInfoList = wxCorpInfoService.list(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
+            if(wxCorpInfoList.size()>0){
+                WxCorpInfo wxCorpInfo = wxCorpInfoList.get(0);
+                String userIds = userList.stream().map(User::getCorpwxRealUserid).collect(Collectors.joining("|"));
+                //todo:推送到企业微信
+                StringBuilder stringBuilder=new StringBuilder();
+                stringBuilder.append("工序  ");
+                stringBuilder.append("工序名称:"+prodProcedure.getName()+"\n"
+                        +"产品名称:"+product.getName()+"\n"
+                        +"排产工单号:"+plan.getProductSchedulingNum());
+                wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,userIds,stringBuilder.toString(),"todayPlan",null);
+            }
         }
         if(!prodProcedureTeamService.saveOrUpdateBatch(list)){
             msg.setError("验证失败");

+ 4 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -249,7 +249,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     @Override
     public void sendWXCorpMsg(WxCorpInfo corpInfo, String corpUserid, String msg, String pageRouter, Integer msgType) {
         try {
-            if (isDev) return;
+//            if (isDev) return;
             log.info("发送企业微信消息===" + corpUserid);
             System.out.println("发送企业微信消息===" + corpUserid);
             String accessToken = getAppConcactAccessToken(corpInfo);
@@ -281,6 +281,9 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                 //费用报销
                 title = "收到新的插单计划";
             }
+            else if("todayPlan".equals(pageRouter)){
+                title="收到新的工作安排";
+            }
             cardJson.put("title", title);
             cardJson.put("description", msg);
             cardJson.put("url", jumpUrl);

+ 3 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/PlanMapper.xml

@@ -31,11 +31,13 @@
         <result column="money_of_job" property="moneyOfJob" />
         <result column="describtion" property="describtion" />
         <result column="version_number" property="versionNumber" />
+        <result column="create_time" property="createTime" />
+        <result column="create_id" property="createId" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, product_scheduling_num, product_id, product_name, project_code, company_id, steel_stamp_number_start, steel_stamp_number_end, num, main_process, station_id, station_name, foreman_id, foreman_name, plan_type, start_date, end_date, task_name, task_type_id, task_type_name, check_type, task_change_notice_num, plan_man_num, plan_work_hour, money_of_job, describtion, version_number
+        id, product_scheduling_num, product_id, product_name, project_code, company_id, steel_stamp_number_start, steel_stamp_number_end, num, main_process, station_id, station_name, foreman_id, foreman_name, plan_type, start_date, end_date, task_name, task_type_id, task_type_name, check_type, task_change_notice_num, plan_man_num, plan_work_hour, money_of_job, describtion, version_number, create_time, create_id
     </sql>
 
 </mapper>

+ 10 - 8
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/component/planComponent.vue

@@ -17,7 +17,7 @@
                   <div>项目代码:</div><span>{{ item.product.code }}</span>
                 </div>
                 <div class="PlanItem">
-                  <div>计划总工价:</div><span class="textBeyondHiding">'-'</span>
+                  <div>计划总工价:</div><span class="textBeyondHiding">{{item.totalMoney}}</span>
                 </div>
                 <div class="PlanItem">
                   <div>数量:</div><span class="textBeyondHiding">{{ item.num }}</span>
@@ -77,13 +77,15 @@ export default {
   watch: {},
   created() { },
   mounted() { 
-    if(this.titleText == '今日计划') {
-      this.paiArr = ['收起', '派工']
-      this.type = 0
-    } else {
-      this.paiArr = ['收起', '展开']
-      this.type = 1
-    }
+    // if(this.titleText == '今日计划') {
+    //   this.paiArr = ['收起', '派工']
+    //   this.type = 0
+    // } else {
+    //   this.paiArr = ['收起', '展开']
+    //   this.type = 1
+    // }
+    this.paiArr = ['收起', '展开']
+    this.type = 0
     this.productList = this.planList
    },
   methods: {

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/todayPlan/todayPlan.vue

@@ -35,7 +35,7 @@ export default {
         pageIndex: 0,
         pageSize: 10000,
         planType: 0,
-        date: this.getNowFormatDate()
+        // date: this.getNowFormatDate()
       })
       .then(res => {
         if (res.code == "ok") {

+ 4 - 2
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/tomorrowPlan/tomorrowPlan.vue

@@ -23,7 +23,9 @@ export default {
   computed: {},
   watch: {},
   created() {},
-  mounted() {},
+  mounted() {
+    this.getPlanList()
+  },
   methods: {
     back() {
       this.$router.go(-1);
@@ -33,7 +35,7 @@ export default {
         pageIndex: 0,
         pageSize: 10000,
         planType: 1,
-        date: this.getNowFormatDate()
+        // date: this.getNowFormatDate()
       })
       .then(res => {
         if (res.code == "ok") {

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/planComponent.vue

@@ -483,6 +483,7 @@ export default {
                   type: "success",
                 });
                 this.editPlanDiaLog = false;
+                 this.getTableData(this.hasChooseDept);
               } else {
                 this.$message({
                   message: res.msg,