Min 11 meses atrás
pai
commit
1df64ed51f
19 arquivos alterados com 511 adições e 71 exclusões
  1. 2 2
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/ProductController.java
  2. 211 9
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/WxCorpInfoController.java
  3. 21 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/WxCorpTemplateController.java
  4. 7 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Product.java
  5. 47 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/WxCorpTemplate.java
  6. 16 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/WxCorpTemplateMapper.java
  7. 1 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/ProductService.java
  8. 2 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/WxCorpInfoService.java
  9. 16 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/WxCorpTemplateService.java
  10. 6 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/PlanServiceImpl.java
  11. 39 41
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ProductServiceImpl.java
  12. 1 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  13. 45 5
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java
  14. 20 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/WxCorpTemplateServiceImpl.java
  15. 2 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ProductMapper.xml
  16. 17 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/WxCorpTemplateMapper.xml
  17. 15 5
      fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/todayPlan/distribution.vue
  18. 37 6
      fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/planComponent.vue
  19. 6 0
      fhKeeper/formulahousekeeper/timesheet-workshop/src/views/product/list.vue

+ 2 - 2
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/ProductController.java

@@ -38,8 +38,8 @@ public class ProductController {
     PlanService planService;
 
     @RequestMapping("/getProductPage")
-    public HttpRespMsg getProductPage(Integer cateId, @RequestParam Integer pageIndex, @RequestParam Integer pageSize, String name, String code,@RequestParam(defaultValue = "0")Integer status) {
-        return productService.getProductPage(cateId, pageIndex, pageSize, name, code,status, request);
+    public HttpRespMsg getProductPage(Integer cateId, @RequestParam Integer pageIndex, @RequestParam Integer pageSize, String name, String code,@RequestParam(defaultValue = "0")Integer status,String projectName) {
+        return productService.getProductPage(cateId, pageIndex, pageSize, name, code,status,projectName, request);
     }
 
     @RequestMapping("/saveProductInfo")

+ 211 - 9
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/WxCorpInfoController.java

@@ -5,25 +5,24 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.management.platform.entity.LeaveSheet;
-import com.management.platform.entity.User;
-import com.management.platform.entity.WxCorpInfo;
+import com.management.platform.entity.*;
 import com.management.platform.mapper.UserMapper;
-import com.management.platform.service.LeaveSheetService;
-import com.management.platform.service.WxCorpInfoService;
+import com.management.platform.service.*;
 import com.management.platform.util.DateTimeUtil;
 import com.management.platform.util.HttpRespMsg;
+import org.springframework.http.*;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
+import java.time.LocalDateTime;
+import java.util.*;
 
 /**
  * <p>
@@ -43,6 +42,16 @@ public class WxCorpInfoController {
     UserMapper userMapper;
     @Resource
     LeaveSheetService leaveSheetService;
+    @Resource
+    ReportService reportService;
+    @Resource
+    WxCorpTemplateService wxCorpTemplateService;
+    @Resource
+    DepartmentService departmentService;
+    @Resource
+    TaskTypeService taskTypeService;
+    @Resource
+    PlanService planService;
 
     @RequestMapping("/testDownload")
     public HttpRespMsg testDownload() {
@@ -197,8 +206,201 @@ public class WxCorpInfoController {
         return msg;
     }
 
-    public static void main(String[] args) {
+    @RequestMapping("/testSyncTemporaryJobApplication")
+    @Transactional
+    public HttpRespMsg testSyncTemporaryJobApplication(String startDate,String endDate)throws Exception{
+        HttpRespMsg msg=new HttpRespMsg();
+        JSONArray jsonArrayFilter = new JSONArray();
+        JSONObject filter1 = new JSONObject();
+        WxCorpTemplate template = wxCorpTemplateService.getById(7);
+        filter1.put("key","template_id");
+        filter1.put("value",template.getTemplateId());
+        jsonArrayFilter.add(filter1);
+        JSONObject filter2 = new JSONObject();
+        filter2.put("key","sp_status");
+        filter2.put("value",2);
+        jsonArrayFilter.add(filter2);
+        List<String> approvalInfo = wxCorpInfoService.getApprovalInfo(7, startDate, endDate, "", jsonArrayFilter);
+        List<Department> departmentList = departmentService.list(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, 7));
+        List<TaskType> taskTypeList = taskTypeService.list(new LambdaQueryWrapper<TaskType>().eq(TaskType::getCompanyId, 7));
+        List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId,7));
+        if(approvalInfo!=null){
+            List<Report> reports = new ArrayList<>();
+            for (int i = 0; i < approvalInfo.size(); i++) {
+                String codeNum = approvalInfo.get(i);
+                String approvalInfoDetailResp = wxCorpInfoService.getApprovalInfoDetail(7, codeNum);
+                JSONObject approvalInfoDetail = JSONObject.parseObject(approvalInfoDetailResp);
+                JSONObject info = approvalInfoDetail.getJSONObject("info");
+                JSONObject applyer = info.getJSONObject("applyer");
+                String userid = applyer.getString("userid");
+                Optional<User> first = userList.stream().filter(u ->u.getCorpwxRealUserid()!=null&&u.getCorpwxRealUserid().equals(userid)).findFirst();
+                if(!first.isPresent()){
+                    continue;
+                }
+                JSONObject apply_data = info.getJSONObject("apply_data");
+                System.out.println("获取到的单据信息===========>"+apply_data);
+                JSONArray contents = apply_data.getJSONArray("contents");
+                //生成 车间插单计划
+                Plan plan=new Plan();
+                plan.setCreateTime(LocalDateTime.now());
+                plan.setPlanType(1);
+                plan.setCreateId(first.get().getId());
+                //参与人员列表
+                List<String> userTeams=new ArrayList<>();
+                //初始化 单价(元/小时)
+                BigDecimal price=new BigDecimal(0);
+                //初始化 工作时长
+                double workTime=0;
+                //初始话 工作日期
+                JSONArray sp_record = info.getJSONArray("sp_record");
+                //获取最后一个审批节点
+                JSONObject last_sp_record = sp_record.getJSONObject(sp_record.size() - 1);
+                JSONArray details = last_sp_record.getJSONArray("details");
+                //获取最后详情
+                JSONObject lastDetail = details.getJSONObject(details.size() - 1);
+                long sptime = lastDetail.getLongValue("sptime");
+                LocalDate createDate=LocalDate.now();
+                //初始化工位
+                Integer deptId=0;
+                for (int i1 = 0; i1 < contents.size(); i1++) {
+                    JSONObject map = contents.getJSONObject(i1);
+                    JSONArray title = map.getJSONArray("title");
+                    JSONObject value = map.getJSONObject("value");
+                    String control = map.getString("control");
+                    if(title.getJSONObject(0).getString("text").equals("临时报工分类")){
+                        if(control.equals("Selector")){
+                            JSONObject selector = value.getJSONObject("selector");
+                            JSONArray options = selector.getJSONArray("options");
+                            JSONObject object = options.getJSONObject(0);
+                            JSONArray value1 = object.getJSONArray("value");
+                            JSONObject jsonObject = value1.getJSONObject(0);
+                            String text = jsonObject.getString("text");
+                            Optional<TaskType> first1 = taskTypeList.stream().filter(t -> t.getTaskTypeName().equals(text)).findFirst();
+                            if(first1.isPresent()){
+                                plan.setTaskTypeId(first1.get().getId());
+                                plan.setTaskTypeName(first1.get().getTaskTypeName());
+                            }
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("事由")){
+                        if(control.equals("Text")||control.equals("Textarea")){
+                            String text = value.getString("text");
+                            plan.setTaskName(text);
+                        }
+                    }
+                    //先处理多个人员 公用此单据非工时部分内容
+                    if(title.getJSONObject(0).getString("text").equals("参与人员")){
+                        if(control.equals("Contact")){
+                            JSONArray members = value.getJSONArray("members");
+                            for (int i2 = 0; i2 < members.size(); i2++) {
+                                JSONObject jsonObject = members.getJSONObject(i2);
+                                String userid1 = jsonObject.getString("userid");
+                                userTeams.add(userid1);
+                            }
+
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("参与人数")){
+                        if(control.equals("Number")){
+                            int new_number = value.getIntValue("new_number");
+                            plan.setPlanManNum(new_number);
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("开始时间")){
+                        if(control.equals("Date")){
+                            long s_timestamp = value.getLongValue("s_timestamp");
+                            LocalDate localDateFromUnix = DateTimeUtil.getLocalDateFromUnix(s_timestamp);
+                            plan.setStartDate(localDateFromUnix);
+                            if(sptime!=0){
+                                createDate= DateTimeUtil.getLocalDateFromUnix(sptime);
+                            }else {
+                                createDate=localDateFromUnix;
+                            }
 
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("结束时间")){
+                        if(control.equals("Date")){
+                            long s_timestamp = value.getLongValue("s_timestamp");
+                            LocalDate localDateFromUnix = DateTimeUtil.getLocalDateFromUnix(s_timestamp);
+                            plan.setEndDate(localDateFromUnix);
+                            if(sptime!=0){
+                                createDate= DateTimeUtil.getLocalDateFromUnix(sptime);
+                            }else {
+                                createDate=localDateFromUnix;
+                            }
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("工作时长")){
+                        if(control.equals("Number")){
+                            double new_number = value.getDoubleValue("new_number");
+                            workTime=new_number;
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("申请总时长")){
+                        if(control.equals("Number")){
+                            double new_number = value.getDoubleValue("new_number");
+                            plan.setPlanWorkHour(new_number);
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("所属工位")){
+                        if(control.equals("Contact")){
+                            JSONArray departments = value.getJSONArray("departments");
+                            String openapi_id = departments.getJSONObject(0).getString("openapi_id");
+                            Optional<Department> first1 = departmentList.stream().filter(d -> d.getCorpwxDeptid().equals(Integer.valueOf(openapi_id))).findFirst();
+                            if(first1.isPresent()){
+                                plan.setStationId(first1.get().getDepartmentId());
+                                plan.setStationName(first1.get().getDepartmentName());
+                                plan.setForemanId(first1.get().getManagerId());
+                                Optional<User> first2 = userList.stream().filter(u -> u.getId().equals(first1.get().getManagerId())).findFirst();
+                                if(first2.isPresent()){
+                                    plan.setForemanName(first2.get().getName());
+                                }
+                                deptId=first1.get().getDepartmentId();
+                            }
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").contains("单价")){
+                        if(control.equals("Money")){
+                            Double new_money = value.getDouble("new_money");
+                            plan.setMoneyOfJob(new BigDecimal(new_money));
+                            price=new BigDecimal(new_money);
+                        }
+                    }
+                    if(title.getJSONObject(0).getString("text").equals("备注")){
+                        if(control.equals("Text")||control.equals("Textarea")){
+                            String text = value.getString("text");
+                            plan.setDescribtion(text);
+                        }
+                    }
+                }
+                List<Report> reportList=new ArrayList<>();
+                //处理人员日报数据
+                for (String userTeam : userTeams) {
+                    Optional<User> user = userList.stream().filter(u -> u.getCorpwxRealUserid() != null && u.getCorpwxRealUserid().equals(userTeam)).findFirst();
+                    if(user.isPresent()){
+                        Report report=new Report();
+                        report.setCreateDate(createDate);
+                        report.setCreatorId(user.get().getId());
+                        report.setCreateTime(LocalDateTime.now());
+                        BigDecimal bigDecimal = new BigDecimal(workTime);
+                        bigDecimal=bigDecimal.multiply(price);
+                        report.setCost(bigDecimal);
+                        report.setWorkingTime(workTime);
+                        report.setStatus(2);
+                        report.setCompanyId(7);
+                        report.setDeptId(deptId);
+                        reportList.add(report);
+                    }
+                }
+                if(reportList.size()>0){
+                    reportService.saveBatch(reportList);
+                }
+                planService.save(plan);
+            }
+        }
+        msg.setData(approvalInfo);
+        return msg;
     }
 }
 

+ 21 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/WxCorpTemplateController.java

@@ -0,0 +1,21 @@
+package com.management.platform.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-19
+ */
+@RestController
+@RequestMapping("/wx-corp-template")
+public class WxCorpTemplateController {
+
+}
+

+ 7 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/Product.java

@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2024-06-03
+ * @since 2024-06-19
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -57,6 +57,12 @@ public class Product extends Model<Product> {
     @TableField("code")
     private String code;
 
+    /**
+     * 项目名称
+     */
+    @TableField("project_name")
+    private String projectName;
+
     /**
      * 编组
      */

+ 47 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/WxCorpTemplate.java

@@ -0,0 +1,47 @@
+package com.management.platform.entity;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class WxCorpTemplate extends Model<WxCorpTemplate> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId("company_id")
+    private Integer companyId;
+
+    /**
+     * 审批模板id
+     */
+    @TableField("template_id")
+    private String templateId;
+
+    /**
+     * 0-立项审批
+     */
+    @TableField("type")
+    private Integer type;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.companyId;
+    }
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/WxCorpTemplateMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.WxCorpTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-19
+ */
+public interface WxCorpTemplateMapper extends BaseMapper<WxCorpTemplate> {
+
+}

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

@@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletRequest;
  */
 public interface ProductService extends IService<Product> {
 
-    HttpRespMsg getProductPage(Integer cateId, Integer pageIndex, Integer pageSize, String name, String code,Integer status, HttpServletRequest request);
+    HttpRespMsg getProductPage(Integer cateId, Integer pageIndex, Integer pageSize, String name, String code,Integer status,String projectName, HttpServletRequest request);
 
     HttpRespMsg saveProductInfo(Product product, HttpServletRequest request);
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/WxCorpInfoService.java

@@ -83,5 +83,7 @@ public interface WxCorpInfoService extends IService<WxCorpInfo> {
 
     List<String> getApprovalInfo(Integer companyId, String startDate, String endDate,String newCursor, JSONArray jsonArrayFilter) throws Exception;
 
+    String getTemplateDetail(Integer companyId) throws Exception;
+
     String getApprovalInfoDetail(Integer companyId, String spNo) throws Exception;
 }

+ 16 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/WxCorpTemplateService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.WxCorpTemplate;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-19
+ */
+public interface WxCorpTemplateService extends IService<WxCorpTemplate> {
+
+}

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

@@ -14,6 +14,7 @@ import com.management.platform.util.DateTimeUtil;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
+import com.sun.org.apache.regexp.internal.RE;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.CellType;
@@ -1197,6 +1198,11 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
         }
         List<String> idList =new ArrayList<>(Arrays.asList(ids.split(",")));
         idList.add("-1");
+        List<Report> reports = reportMapper.selectList(new LambdaQueryWrapper<Report>().in(Report::getUserProcedureTeamId, idList));
+        if(reports.size()>0){
+            msg.setError("存在以报工计划,无法拒收");
+            return msg;
+        }
         if(!prodProcedureTeamService.removeByIds(idList)){
             msg.setError("验证失败");
         }

+ 39 - 41
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ProductServiceImpl.java

@@ -73,7 +73,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
     private ExcelExportService excelExportService;
 
     @Override
-    public HttpRespMsg getProductPage(Integer cateId, Integer pageIndex, Integer pageSize, String name, String code,Integer status, HttpServletRequest request) {
+    public HttpRespMsg getProductPage(Integer cateId, Integer pageIndex, Integer pageSize, String name, String code,Integer status,String projectName, HttpServletRequest request) {
         QueryWrapper<Product> queryWrapper = new QueryWrapper<>();
         if (cateId != null) {
             queryWrapper.eq("category_id",cateId);
@@ -84,6 +84,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         if (!StringUtils.isEmpty(code)) {
             queryWrapper.like("code",code);
         }
+        if(!StringUtils.isEmpty(projectName)){
+            queryWrapper.like("project_name",projectName);
+        }
         queryWrapper.eq("status",status);
         User user = userMapper.selectById(request.getHeader("Token"));
         queryWrapper.eq("company_id",user.getCompanyId()).orderByDesc("id");
@@ -113,52 +116,47 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
 
         product.setCompanyId(user.getCompanyId());
 
-        Integer count = productMapper.selectCount(new LambdaQueryWrapper<Product>()
-                .eq(user.getCompanyId() != null, Product::getCompanyId, user.getCompanyId())
-                .eq(!StringUtils.isEmpty(product.getName()), Product::getName, product.getName())
-        );
+        Integer count ;
+        if(product.getId()==null){
+            count = productMapper.selectCount(new LambdaQueryWrapper<Product>()
+                    .eq(user.getCompanyId() != null, Product::getCompanyId, user.getCompanyId())
+                    .eq(!StringUtils.isEmpty(product.getName()), Product::getName, product.getName()).eq(Product::getProjectName,product.getProjectName())
+            );
+        }else {
+            count = productMapper.selectCount(new LambdaQueryWrapper<Product>()
+                    .ne(Product::getId,product.getId()).eq(user.getCompanyId() != null, Product::getCompanyId, user.getCompanyId())
+                    .eq(!StringUtils.isEmpty(product.getName()), Product::getName, product.getName()).eq(Product::getProjectName,product.getProjectName())
+            );
+        }
+        if(count>0){
+            msg.setError("项目名称["+product.getProjectName()+"]下产品名重复");
+            return msg;
+        }
         if (product.getId() == null) {
-            //新增
-            if(count==0){
-                productMapper.insert(product);
-
-            }else{
-                msg.setError("产品名重复");
-            }
+            productMapper.insert(product);
         } else {
-            //修改
-            if(count<2){
-                productMapper.updateById(product);
-
-                //修改对应工序中产品的名字
-                ProdProcedure prodProcedure=new ProdProcedure();
-                prodProcedure.setProductName(product.getName());
-                prodProcedureService.update(prodProcedure,
-                        new LambdaQueryWrapper<ProdProcedure>()
-                                .eq(product.getId()!=null,ProdProcedure::getProductId,product.getId())
-                                .eq(user.getCompanyId() != null, ProdProcedure::getCompanyId, user.getCompanyId())
-                );
-                //修改相关计划下 产品名称以及编码
-                List<Plan> planList = planMapper.selectList(new LambdaQueryWrapper<Plan>().eq(Plan::getProductId, product.getId()));
-                planList.forEach(p->{
-                    p.setProductId(product.getId());
-                    p.setProductName(product.getName());
-                    p.setProjectCode(product.getCode());
-                });
-                if(planList.size()>0){
-                    planService.updateBatchById(planList);
-                }
-            }else{
-                msg.setError("产品名重复");
+            productMapper.updateById(product);
+            //修改对应工序中产品的名字
+            ProdProcedure prodProcedure=new ProdProcedure();
+            prodProcedure.setProductName(product.getName());
+            prodProcedureService.update(prodProcedure,
+                    new LambdaQueryWrapper<ProdProcedure>()
+                            .eq(product.getId()!=null,ProdProcedure::getProductId,product.getId())
+                            .eq(user.getCompanyId() != null, ProdProcedure::getCompanyId, user.getCompanyId())
+            );
+            //修改相关计划下 产品名称以及编码
+            List<Plan> planList = planMapper.selectList(new LambdaQueryWrapper<Plan>().eq(Plan::getProductId, product.getId()));
+            planList.forEach(p->{
+                p.setProductId(product.getId());
+                p.setProductName(product.getName());
+                p.setProjectCode(product.getCode());
+            });
+            if(planList.size()>0){
+                planService.updateBatchById(planList);
             }
-
         }
-
         System.out.println(product);
         msg.setData(product);
-
-
-
         return msg;
     }
 

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

@@ -4120,6 +4120,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         List<LeaveSheet> leaveSheetList = leaveSheetService.list(new LambdaQueryWrapper<LeaveSheet>().le(LeaveSheet::getStartDate, endDate).ge(LeaveSheet::getEndDate, startDate));
         //日期范围内所有派工数据
         List<Integer> ids = allProcedureTeamList.stream().map(ProdProcedureTeam::getPlanProcedureId).distinct().collect(Collectors.toList());
+        ids.add(-1);
         List<PlanProcedureTotal> planProcedureTotalList = planProcedureTotalMapper.selectList(new LambdaQueryWrapper<PlanProcedureTotal>().in(PlanProcedureTotal::getId, ids));
         for (User u : userList) {
             List<Map<String, Object>> mapList = personWorkHoursWagesList.stream().filter(pl -> String.valueOf(pl.get("userId")).equals(u.getId())).collect(Collectors.toList());

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

@@ -8,6 +8,7 @@ import com.management.platform.controller.WeiXinCorpController;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.WxCorpInfoService;
+import com.management.platform.service.WxCorpTemplateService;
 import com.management.platform.util.*;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -82,6 +83,9 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     //获取审批申请详情
     public static final String GET_APPROVAL_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail?access_token=ACCESS_TOKEN";
 
+    //获取企业审批模板详情
+    public static final String GET_TEMPLATE_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/oa/gettemplatedetail?access_token=ACCESS_TOKEN";
+
 
     public static final int TEXT_CARD_MSG_BUSTRIP_WAITING_AUDIT = 0;//出差待审核
     public static final int TEXT_CARD_MSG_BUSTRIP_AGREE = 1;//出差审核通过
@@ -127,6 +131,8 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     UserMapper userMapper;
     @Resource
     UserCorpwxTimeMapper userCorpwxTimeMapper;
+    @Resource
+    WxCorpTemplateService wxCorpTemplateService;
 
     @Resource
     TimeTypeMapper timeTypeMapper;
@@ -1996,12 +2002,15 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         long unixTimestamp = instant.getEpochSecond();
         return unixTimestamp;
     }
-
     /**
-     * 批量获取审批单号
-     * PS:Integer recordType 1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批
-     *    Integer sp_status 1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付
-     * */
+     * @Description:企业内部应用获取指定时间范围内的审批单号
+     * @Param: [companyId, spNo]
+     * @return: java.lang.String
+     * @Author: yurk
+     * @PS: Integer recordType 1-请假;2-打卡补卡;3-出差;4-外出;5-加班; 6- 调班;7-会议室预定;8-退款审批;9-红包报销审批
+     *     Integer sp_status 1-审批中;2-已通过;3-已驳回;4-已撤销;6-通过后撤销;7-已删除;10-已支付
+     * @Date: 2024/6/19
+     */
     @Override
     public List<String> getApprovalInfo(Integer companyId, String startDate, String endDate, String newCursor, JSONArray filterArray) throws Exception {
         DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -2044,7 +2053,38 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         return null;
     }
 
+    /**
+     * 企业内部应用获取企业审批模板详情
+     * */
+    @Override
+    public String getTemplateDetail(Integer companyId) throws Exception {
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",companyId));
+        WxCorpTemplate template = wxCorpTemplateService.getById(wxCorpInfo.getCompanyId());
+        String url=GET_TEMPLATE_DETAIL.replace("ACCESS_TOKEN",getCorpAgentAccessToken(wxCorpInfo));
+        HttpHeaders headers = new HttpHeaders();
+        RestTemplate restTemplate = new RestTemplate();
+        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
+        headers.setContentType(type);
+        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
+        JSONObject requestMap = new JSONObject();
+        requestMap.put("template_id",template.getTemplateId());
+        HttpEntity<JSONObject> entity = new HttpEntity<>(requestMap, headers);
+        ResponseEntity<String> ResponseEntity = restTemplate.postForEntity(url, entity, String.class);
+        if (ResponseEntity.getStatusCode() == HttpStatus.OK) {
+            String resp = ResponseEntity.getBody();
+            return resp;
+        }
+        return null;
+    }
+
 
+    /**
+    * @Description:企业内部应用获取审批单详情
+    * @Param: [companyId, spNo]
+    * @return: java.lang.String
+    * @Author: yurk
+    * @Date: 2024/6/19
+    */
     @Override
     public String getApprovalInfoDetail(Integer companyId,String spNo) throws Exception {
         WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",companyId));

+ 20 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/WxCorpTemplateServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.WxCorpTemplate;
+import com.management.platform.mapper.WxCorpTemplateMapper;
+import com.management.platform.service.WxCorpTemplateService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-19
+ */
+@Service
+public class WxCorpTemplateServiceImpl extends ServiceImpl<WxCorpTemplateMapper, WxCorpTemplate> implements WxCorpTemplateService {
+
+}

+ 2 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ProductMapper.xml

@@ -10,6 +10,7 @@
         <result column="company_id" property="companyId" />
         <result column="category_name" property="categoryName" />
         <result column="code" property="code" />
+        <result column="project_name" property="projectName" />
         <result column="group_number" property="groupNumber" />
         <result column="order_number" property="orderNumber" />
         <result column="unit" property="unit" />
@@ -21,7 +22,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, category_id, company_id, category_name, code, group_number, order_number, unit, column_number, vehicle_number, description, status
+        id, name, category_id, company_id, category_name, code, project_name, group_number, order_number, unit, column_number, vehicle_number, description, status
     </sql>
 
 </mapper>

+ 17 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/WxCorpTemplateMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.management.platform.mapper.WxCorpTemplateMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.WxCorpTemplate">
+        <id column="company_id" property="companyId" />
+        <result column="template_id" property="templateId" />
+        <result column="type" property="type" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        company_id, template_id, type
+    </sql>
+
+</mapper>

+ 15 - 5
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/todayPlan/distribution.vue

@@ -2,11 +2,15 @@
 <div>
   <div class="distribution">
     <van-nav-bar :title="titleText" left-text="返回" :right-text="!todayAndTomorrow ? '下发计划' : ''" @click-left="back" @click-right="placeAnOrder" fixed left-arrow/>
-    <div class="distribution_header">
-      <div>{{ productName }}</div>
-      <div>{{ productSchedulingNum }}</div>
-      <div>{{ dates }}</div>
+    <div style="display: flex;justify-content: space-between;">
+      <div class="distribution_header">
+        <div>{{ productName }}</div>
+        <div>{{ productSchedulingNum }}</div>
+        <div>{{ dates }}</div>
+      </div>
+      <van-button @click="batchUnReceive()" :disabled="!isCanAgree || distributionList.length == 0" type="info" size="small">批量拒收</van-button>
     </div>
+    
     <div class="distribution_con contentRoll">
       <div class="distribution_box" v-for="item,index in distributionList" :key="index">
         <div class="distribution_ItemBom">
@@ -73,7 +77,6 @@
         <van-checkbox v-model="isAllChecked" :disabled="distributionList.length == 0" @click="allChecked" shape="square" style="padding-left:3vw"></van-checkbox>
         <div style="padding:1vh 2vw">
         <van-button style="margin-right: 10px;" @click="batchReceive()" :disabled="!isCanAgree || distributionList.length == 0" type="info" size="small">批量接收</van-button>
-        <van-button @click="batchUnReceive()" :disabled="!isCanAgree || distributionList.length == 0" type="info" size="small">批量拒收</van-button>
         <!-- <van-button @click="cancellationReceiveBatch()" :disabled="!isCanAgree || distributionList.length == 0" type="info" size="small">批量取消接收</van-button> -->
         <!-- <van-button @click="batchAgree(false)" :disabled="!isCanAgree || distributionList.length == 0" type="danger" size="small" style="margin-left:2vw">批量驳回</van-button> -->
         </div>
@@ -178,13 +181,20 @@ export default {
     },
     // 批量操作
     allChecked(){
+        let status=false
         if(this.isAllChecked){
             for(let i in this.distributionList){
                 if(this.distributionList[i].teamNames&&this.distributionList[i].teamNames.indexOf(this.user.name) != -1){
                   this.distributionList[i].prodProcedure.isSelected = true
+                  status=true
                 }
             }
             this.isCanAgree = true
+            if(!status){
+              this.$toast.success('当前不存在可以接受/拒收工序');
+              this.isCanAgree = false
+              this.isAllChecked=false
+            }
         }else{
             for(let i in this.distributionList){
                 this.distributionList[i].prodProcedure.isSelected = false

+ 37 - 6
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/planComponent.vue

@@ -151,6 +151,9 @@
           <el-form-item label="生产订单号" style="width: 100%" prop="productOrderNum">
             <el-input v-model="todayPlanForm.productOrderNum" maxlength="50"></el-input>
           </el-form-item>
+          <el-form-item label="项目名称" style="width: 100%" prop="projectName">
+            <el-input :disabled="todayPlanForm.id==null?false:true"  v-model="todayPlanForm.projectName" maxlength="50" @blur="filterProductList(todayPlanForm.projectName)"></el-input>
+          </el-form-item>
           <el-form-item label="产品名称" style="width: 100%" prop="productId">
             <el-select :disabled="todayPlanForm.id==null?false:true" v-model="todayPlanForm.productId" placeholder="请选择" class="w100" @change="setProductCode" filterable>
               <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
@@ -160,10 +163,6 @@
           <el-form-item label="项目代码" style="width: 100%" prop="projectCode">
             <el-input :disabled="todayPlanForm.id==null?false:true" v-model="todayPlanForm.projectCode" maxlength="50" readonly></el-input>
           </el-form-item>
-          <el-form-item label="项目名称" style="width: 100%" prop="projectName">
-            <el-input  v-model="todayPlanForm.projectName" maxlength="50" ></el-input>
-          </el-form-item>
-
           <div v-for="(item, index) in todayPlanForm.steelStampNumberList" style="width: 100%;margin-bottom: 10px;">
             <el-form-item label="钢印号" :key="index" style="width: 100%" prop="steelStampNumberStart">
               <el-input class="w45" v-model="item.steelStampNumberStart" maxlength="20"></el-input>
@@ -471,6 +470,34 @@ export default {
         ruleIndexEnd: '',
       });   // 在数组中添加一个空对象
     },
+    filterProductList(value){
+      this.todayPlanForm.productId=null,
+      this.todayPlanForm.projectCode=null,
+      this.http.post(
+          "/product/getProductPage",
+          {
+            pageIndex: null,
+            pageSize: null,
+            projectName:value
+          },
+          (res) => {
+            if (res.code == "ok") {
+              this.productList = res.data.records;
+            } else {
+              this.$message({
+                message: res.msg,
+                type: "error",
+              });
+            }
+          },
+          (error) => {
+            this.$message({
+              message: error,
+              type: "error",
+            });
+          }
+        );
+    },
     deleteInput(index) {
       this.todayPlanForm.steelStampNumberList.splice(index, 1)
     },
@@ -500,8 +527,12 @@ export default {
     setProductCode() {
       let arrList = this.productList.filter(item => item.id == this.todayPlanForm.productId)
       console.log('====>', arrList)
-      this.todayPlanForm.projectCode = arrList[0].code
-      this.todayPlanForm.productName = arrList[0].name
+      // this.todayPlanForm.projectCode = arrList[0].code
+      // this.todayPlanForm.projectName = arrList[0].projectName
+      // this.todayPlanForm.productName = arrList[0].name
+      this.$set(this.todayPlanForm, "projectCode", arrList[0].code)
+      this.$set(this.todayPlanForm, "projectName", arrList[0].projectName)
+      this.$set(this.todayPlanForm, "productName", arrList[0].name)
     },
     today() {
       let date = new Date();

+ 6 - 0
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/product/list.vue

@@ -128,6 +128,7 @@
             <el-table-column type="selection" width="55">
             </el-table-column>
             <el-table-column prop="name" label="产品名称"  width="300"></el-table-column>
+            <el-table-column prop="projectName" label="项目名称" width="200"></el-table-column>
             <el-table-column prop="code" label="项目代码" width="200"></el-table-column>
             <el-table-column prop="orderNumber" label="订单数量" width="100"></el-table-column>
             <el-table-column prop="unit" label="单位" width="100"></el-table-column>
@@ -191,6 +192,10 @@
                         <el-input v-model="addForm.name" :placeholder="$t('peaseenterthe')" clearable maxlength="50"
                             show-word-limit="true"></el-input>
                     </el-form-item>
+                    <el-form-item label="项目名称" prop="projectName">
+                        <el-input v-model="addForm.projectName" :placeholder="$t('peaseenterthe')" clearable maxlength="50"
+                            show-word-limit="true"></el-input>
+                    </el-form-item>
                     <el-form-item label="项目代码" prop="code">
                         <!-- <el-input v-model="addForm.code" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目编号" clearable></el-input> -->
                         <el-input v-model="addForm.code" :placeholder="$t('peaseenterthe')" clearable maxlength="50"
@@ -803,6 +808,7 @@ export default {
             rules: {
                 name: [{ required: true, message: this.$t('pleaseentername'), trigger: "blur" }],
                 code: [{ required: true, message: "请输入项目代码", trigger: "blur" }],
+                projectName: [{ required: true, message: "请输入项目名称", trigger: "blur" }],
                 orderNumber: [{ required: true, message:' 请输入订单数量', trigger: "blur" }],
                 unit: [{ required: true, message: '请输入单位', trigger: "blur" }],
                 groupNumber: [{ required: true, message: '请输入编组', trigger: "blur" }],