From 02e13964dd95077c5f515156bc0da5187f5c8cf3 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期三, 19 六月 2024 11:49:37 +0800 Subject: [PATCH] 工时分组排序+制单人字段 --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java | 33 +++++--- inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java | 3 performance-server/src/main/java/com/yuanchu/mom/pojo/Evaluate.java | 14 +++ inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 3 performance-server/src/main/java/com/yuanchu/mom/service/impl/EvaluateServiceImpl.java | 23 +++++ inspect-server/src/main/resources/mapper/StandardProductListMapper.xml | 16 ++++ performance-server/src/main/java/com/yuanchu/mom/service/EvaluateService.java | 4 + inspect-server/src/main/resources/mapper/StandardTreeMapper.xml | 65 ++++++++------- inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java | 7 + performance-server/src/main/java/com/yuanchu/mom/controller/EvaluateController.java | 26 ++++++ 10 files changed, 150 insertions(+), 44 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java index a264777..5a43899 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java @@ -3,6 +3,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.yuanchu.mom.pojo.StandardProductList; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @author Administrator @@ -15,6 +18,10 @@ IPage<StandardProductList> standardProductListIPage(Integer id, String tree, IPage<StandardProductList> iPage, String laboratory, String item, String items); StandardProductList getOne(Integer standardMethodListId, String inspectionItem, String sample, String inspectionItemSubclass, String model); + + List<StandardProductList> selectDetail(@Param("standardMethodListId") Integer standardMethodListId, @Param("state") int state, @Param("model") String model); + + List<StandardProductList> selectDetail2(@Param("standardMethodListId") Integer standardMethodListId, @Param("state") int state, @Param("tree") String tree); } diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java index 2281682..94ff3c9 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java @@ -203,4 +203,7 @@ private Long companyId; + @ValueTableShow(value = 15, name = "鍒跺崟浜�") + private String prepareUser; + } diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java index 7493e30..59ffb72 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java @@ -788,7 +788,8 @@ } catch (Exception e) { throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�"); } - Custom custom = customMapper.selectById(user.get("company")); + //Custom custom = customMapper.selectById(user.get("company")); + Custom custom = customMapper.selectById(insOrder.getCompanyId()); if (!resultCh.get().equals("")) { resultCh.set("渚濇嵁濮旀墭瑕佹眰锛�" + resultCh.get().replaceFirst("銆�", "") + "绛夋墍妫�椤圭洰涓嶇鍚堣姹傦紝鍏朵綑鎵�妫�椤圭洰鍧囩鍚堣姹傘��"); resultEn.set("According to commissioned requirements," + resultEn.get().replaceFirst("銆�", "") + " these inspected items do not meet the requirements, all other inspected items meet the requirements."); diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java index 4663183..c740528 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java @@ -56,16 +56,23 @@ @Override public List<StandardProductList> selectStandardProductList(InsSample insSample) { String[] models = insSample.getModel().split("-(?=[^-]*$)");//鎷嗗垎鏈�鍚庝竴涓��-銆� - List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0])); + List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, models[0]); + /* List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() + .eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()) + .eq(StandardProductList::getState, 1) + .eq(StandardProductList::getModel, models[0]) + .apply("ORDER BY case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), man_hour_group REGEXP '^[0-9]', id asc "));*/ if (list.size() == 0) { - if(Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null){ + if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) { return null; } String[] split = insSample.getFactory().split(" - "); - list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() + list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3]); + /*list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() .eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()) .eq(StandardProductList::getState, 1) - .like(StandardProductList::getTree, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3])); + .like(StandardProductList::getTree, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3]) + .apply("ORDER BY case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), man_hour_group REGEXP '^[0-9]', id asc "));*/ } list = list.stream().filter(a -> { try { @@ -77,9 +84,9 @@ List<String> prices = JSON.parseArray(a.getPrice(), String.class); boolean isIf; for (int i = 0; i < sections.size(); i++) { - if(Objects.equals(a.getBsm(), "1")){ + if (Objects.equals(a.getBsm(), "1")) { return true; - }else{ + } else { if (sections.get(i).contains("&")) { String[] split = sections.get(i).split("&"); isIf = getIsIf(split[0], models[1]) && getIsIf(split[1], models[1]); @@ -106,7 +113,7 @@ return list; } - private boolean getIsIf(String str, String model){ + private boolean getIsIf(String str, String model) { Matcher matcher = Pattern.compile("\\d+(\\.\\d+)?").matcher(model); String model2 = ""; while (matcher.find()) { @@ -118,10 +125,10 @@ } else if (str.contains("鈮�") || str.contains("<=")) { String param = str.replace("鈮�", "").replace("<=", ""); return new BigDecimal(model2).compareTo(new BigDecimal(param)) < 1; - } else if (str.contains(">")||str.contains("锛�")) { + } else if (str.contains(">") || str.contains("锛�")) { String param = str.replace(">", "").replace("锛�", ""); return new BigDecimal(model2).compareTo(new BigDecimal(param)) > 0; - } else if (str.contains("<")||str.contains("锛�")) { + } else if (str.contains("<") || str.contains("锛�")) { String param = str.replace("<", "").replace("锛�", ""); return new BigDecimal(model2).compareTo(new BigDecimal(param)) < 0; } else if (str.contains("=")) { @@ -174,7 +181,7 @@ for (StandardProductList sp : standardProductLists) { for (StandardProductList pl : list) { if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem()) - && Objects.equals((sp.getInspectionItemSubclass() == null)? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass()) + && Objects.equals((sp.getInspectionItemSubclass() == null) ? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass()) && Objects.equals(sp.getModel(), pl.getModel()) && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) { pl.setId(sp.getId()); @@ -202,7 +209,7 @@ if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) { pl.setTemplateId(sp.getTemplateId()); } - if(sp.getTree() != null && !sp.getTree().equals("")){ + if (sp.getTree() != null && !sp.getTree().equals("")) { pl.setTree(sp.getTree()); } break; @@ -212,9 +219,9 @@ if (page == 1) { Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); CompletableFuture.supplyAsync(() -> { - if(trees.length == 5){ + if (trees.length == 5) { standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree)); - }else{ + } else { standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree)); } standardProductListService2.saveBatch(list.stream().map(a -> { diff --git a/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml b/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml index a696171..5114a23 100644 --- a/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml +++ b/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml @@ -57,4 +57,20 @@ and model = #{model} </if> </select> + <select id="selectDetail" resultType="com.yuanchu.mom.pojo.StandardProductList"> + select * from standard_product_list + where standard_method_list_id = #{standardMethodListId} + and state =#{state} + and model=#{model} + order by case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), + man_hour_group REGEXP '^[0-9]', id asc + </select> + <select id="selectDetail2" resultType="com.yuanchu.mom.pojo.StandardProductList"> + select * from standard_product_list + where standard_method_list_id = #{standardMethodListId} + and state =#{state} + and tree=#{tree} + order by case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), + man_hour_group REGEXP '^[0-9]', id asc + </select> </mapper> diff --git a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml index b0072ed..e0590ad 100644 --- a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml +++ b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml @@ -3,7 +3,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.yuanchu.mom.mapper.StandardTreeMapper"> - <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.StandardTree"> <id property="id" column="id" jdbcType="INTEGER"/> <result property="factory" column="factory" jdbcType="VARCHAR"/> @@ -47,10 +46,10 @@ </resultMap> <select id="selectStandardTreeList" resultMap="FactoryDto"> - select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory, - l.laboratory_name laboratory, - sto.specimen_name sample_type, - p.name sample, + select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory, + l.laboratory_name laboratory, + sto.specimen_name sample_type, + p.name sample, st.model, sto.code from laboratory l @@ -58,7 +57,7 @@ left join product p on p.object_id = sto.id left join standard_tree st on st.sample_type = sto.specimen_name and st.sample = p.name - order by l.id,CAST(sto.code AS DECIMAL),p.id,ISNULL(st.id),st.id + order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id </select> <select id="selectStandardProductById" resultType="com.yuanchu.mom.pojo.StandardProductList"> @@ -117,10 +116,10 @@ </if> </select> <select id="selectStandardTreeList2" resultType="com.yuanchu.mom.pojo.StandardTree"> - select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory, - l.laboratory_name laboratory, - sto.specimen_name sample_type, - p.name sample + select '涓ぉ绉戞妧妫�娴嬩腑蹇�' factory, + l.laboratory_name laboratory, + sto.specimen_name sample_type, + p.name sample from laboratory l left join structure_test_object sto on sto.laboratory_id = l.id left join product p on p.object_id = sto.id @@ -131,7 +130,7 @@ group by sto.specimen_name </select> <select id="selectStandardProductListByTree" resultType="com.yuanchu.mom.pojo.StandardProductList"> - select sample sample2, + select sample sample2, inspection_item, inspection_item_en, inspection_item_subclass, @@ -141,7 +140,7 @@ method, son_laboratory, unit, - ask_tell tell, + ask_tell tell, ask, price, man_hour, @@ -155,11 +154,11 @@ checkout_number, section, dic, - 0 state, - #{model} model, + 0 state, + #{model} model, #{sample} sample, - #{trees} tree, - id structure_item_parameter_id + #{trees} tree, + id structure_item_parameter_id from structure_item_parameter where ( sample is NULL @@ -167,10 +166,12 @@ or sample = '[]' OR sample LIKE CONCAT('%[', #{tree}, ']%') ) + order by case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), + man_hour_group REGEXP '^[0-9]', id asc </select> <select id="selectStandardProductListByTree2" resultType="com.yuanchu.mom.pojo.StandardProductList"> - select sample sample2, + select sample sample2, inspection_item, inspection_item_en, inspection_item_subclass, @@ -180,7 +181,7 @@ method, son_laboratory, unit, - ask_tell tell, + ask_tell tell, ask, price, man_hour, @@ -194,13 +195,15 @@ checkout_number, section, dic, - 0 state, - #{model} model, + 0 state, + #{model} model, #{sample} sample, - #{trees} tree, - id structure_item_parameter_id + #{trees} tree, + id structure_item_parameter_id from structure_item_parameter where sample LIKE CONCAT('%[', #{tree}, ']%') + order by case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), + man_hour_group REGEXP '^[0-9]', id asc </select> <select id="getStandardTree2" resultMap="SampleTypeDto"> @@ -213,7 +216,7 @@ and st.sample = p.name </select> <select id="selectStandardProductListByTree3" resultType="com.yuanchu.mom.pojo.StandardProductList"> - select sample sample2, + select sample sample2, inspection_item, inspection_item_en, inspection_item_subclass, @@ -223,7 +226,7 @@ method, son_laboratory, unit, - ask_tell tell, + ask_tell tell, ask, price, man_hour, @@ -237,11 +240,11 @@ checkout_number, section, dic, - 0 state, - #{model} model, + 0 state, + #{model} model, #{sample} sample, - #{trees} tree, - id structure_item_parameter_id + #{trees} tree, + id structure_item_parameter_id from structure_item_parameter where ( sample is NULL @@ -249,18 +252,20 @@ or sample = '[]' OR sample LIKE CONCAT('%', #{tree}, '%') ) + order by case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), + man_hour_group REGEXP '^[0-9]', id asc </select> <select id="getStandardTree3" resultType="com.yuanchu.mom.dto.SampleDto"> select model label, model value from standard_tree where sample_type = #{sampleType} - and sample is null + and sample is null </select> <select id="getLaboratory" resultType="java.lang.String"> select l.laboratory_name from structure_test_object sto - left join laboratory l on sto.laboratory_id = l.id + left join laboratory l on sto.laboratory_id = l.id where sto.specimen_name = #{str} </select> <select id="getStructureItemParameterId" resultType="java.lang.Integer"> diff --git a/performance-server/src/main/java/com/yuanchu/mom/controller/EvaluateController.java b/performance-server/src/main/java/com/yuanchu/mom/controller/EvaluateController.java index 5815d15..49f76bb 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/controller/EvaluateController.java +++ b/performance-server/src/main/java/com/yuanchu/mom/controller/EvaluateController.java @@ -1,8 +1,21 @@ package com.yuanchu.mom.controller; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.yuanchu.mom.annotation.ValueClassify; +import com.yuanchu.mom.pojo.AuxiliaryWorkingHours; +import com.yuanchu.mom.pojo.Evaluate; +import com.yuanchu.mom.service.EvaluateService; +import com.yuanchu.mom.utils.JackSonUtil; +import com.yuanchu.mom.vo.Result; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Map; /** * <p> @@ -17,4 +30,17 @@ @RequestMapping("/evaluate") public class EvaluateController { + + @Resource + private EvaluateService evaluateService; + + @ValueClassify("浜哄憳鑰冭瘎") + @ApiOperation(value="鑰冭瘎鍒嗛〉鏌ヨ") + @PostMapping("/page") + public Result page(@RequestBody Map<String, Object> data) throws Exception { + Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); + Evaluate entity = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), Evaluate.class); + return Result.success(evaluateService.getPage(page,entity)); + } + } diff --git a/performance-server/src/main/java/com/yuanchu/mom/pojo/Evaluate.java b/performance-server/src/main/java/com/yuanchu/mom/pojo/Evaluate.java index 6a9f0fe..8de043a 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/pojo/Evaluate.java +++ b/performance-server/src/main/java/com/yuanchu/mom/pojo/Evaluate.java @@ -1,9 +1,11 @@ package com.yuanchu.mom.pojo; +import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import java.io.Serializable; +import java.time.LocalDateTime; import com.yuanchu.mom.annotation.ValueTableShow; import com.yuanchu.mom.common.OrderBy; @@ -61,4 +63,16 @@ @ApiModelProperty("鏈堜唤") private String month; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @TableField(fill = FieldFill.INSERT) + private Integer createUser; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Integer updateUser; } diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/EvaluateService.java b/performance-server/src/main/java/com/yuanchu/mom/service/EvaluateService.java index ccbcc80..b214969 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/service/EvaluateService.java +++ b/performance-server/src/main/java/com/yuanchu/mom/service/EvaluateService.java @@ -1,7 +1,10 @@ package com.yuanchu.mom.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.mom.pojo.Evaluate; import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.Map; /** * <p> @@ -13,4 +16,5 @@ */ public interface EvaluateService extends IService<Evaluate> { + Map<String,Object> getPage(Page page, Evaluate entity); } diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/impl/EvaluateServiceImpl.java b/performance-server/src/main/java/com/yuanchu/mom/service/impl/EvaluateServiceImpl.java index a90ea43..6d9ec81 100644 --- a/performance-server/src/main/java/com/yuanchu/mom/service/impl/EvaluateServiceImpl.java +++ b/performance-server/src/main/java/com/yuanchu/mom/service/impl/EvaluateServiceImpl.java @@ -1,10 +1,18 @@ package com.yuanchu.mom.service.impl; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.yuanchu.mom.common.GetLook; +import com.yuanchu.mom.common.PrintChina; import com.yuanchu.mom.pojo.Evaluate; import com.yuanchu.mom.mapper.EvaluateMapper; import com.yuanchu.mom.service.EvaluateService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yuanchu.mom.utils.QueryWrappers; import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; /** * <p> @@ -17,4 +25,19 @@ @Service public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate> implements EvaluateService { + @Resource + EvaluateMapper evaluateMapper; + + @Resource + GetLook getLook; + + @Override + public Map<String, Object> getPage(Page page, Evaluate evaluate) { + Map<String, Object> map = new HashMap<>(); + map.put("head", PrintChina.printChina(Evaluate.class)); + Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("getPage"); + if(map1.get("look")==1) evaluate.setCreateUser(map1.get("userId")); + //map.put("body", evaluateMapper.getPage(page, QueryWrappers.queryWrappers(evaluate))); + return map; + } } -- Gitblit v1.9.3