19d910c3 康伟

kangwei: 大屏药剂组件接口开发

         工作进度统计:增加机构筛选,机构筛选到区域级即可。可以单独查询某个区域的水厂
         水务公司药剂入库增加批量送审功能
1 个父辈 44d441e0
正在显示 19 个修改的文件 包含 337 行增加70 行删除
...@@ -20,6 +20,14 @@ import java.util.regex.Pattern; ...@@ -20,6 +20,14 @@ import java.util.regex.Pattern;
20 */ 20 */
21 public class JSUtils { 21 public class JSUtils {
22 22
23 //判断一个字符串是否是整数,并相应地返回整数或原始字符串
24 public static String convertStringToInt(String str) {
25 if (StringUtils.isNotEmpty(str) && str.endsWith(".00")) {
26 Double dVal = Double.parseDouble(str);
27 return dVal.intValue()+"";
28 }
29 return str;
30 }
23 public static String add(Object obj1 , Object obj2){ 31 public static String add(Object obj1 , Object obj2){
24 String expression = obj1+ "+" + obj2; 32 String expression = obj1+ "+" + obj2;
25 return executeExpression(expression,"0.00"); 33 return executeExpression(expression,"0.00");
......
...@@ -19,6 +19,7 @@ import com.skua.modules.edu.service.IQuestionService; ...@@ -19,6 +19,7 @@ import com.skua.modules.edu.service.IQuestionService;
19 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 19 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
20 import com.baomidou.mybatisplus.core.metadata.IPage; 20 import com.baomidou.mybatisplus.core.metadata.IPage;
21 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 21 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
22 import com.skua.modules.edu.vo.QuestionExcel;
22 import com.skua.modules.system.service.ISysDepartService; 23 import com.skua.modules.system.service.ISysDepartService;
23 import lombok.extern.slf4j.Slf4j; 24 import lombok.extern.slf4j.Slf4j;
24 25
...@@ -289,8 +290,10 @@ public class QuestionController { ...@@ -289,8 +290,10 @@ public class QuestionController {
289 params.setHeadRows(1); 290 params.setHeadRows(1);
290 params.setNeedSave(true); 291 params.setNeedSave(true);
291 try { 292 try {
292 List<Question> listQuestions = ExcelImportUtil.importExcel(file.getInputStream(), Question.class, params); 293 String dbId = request.getParameter("dbId");
293 questionService.saveBatch(listQuestions); 294
295 List<QuestionExcel> listQuestions = ExcelImportUtil.importExcel(file.getInputStream(), QuestionExcel.class, params);
296 questionService.batchImportExcel(listQuestions,dbId);
294 return Result.ok("文件导入成功!数据行数:" + listQuestions.size()); 297 return Result.ok("文件导入成功!数据行数:" + listQuestions.size());
295 } catch (Exception e) { 298 } catch (Exception e) {
296 log.error(e.getMessage(),e); 299 log.error(e.getMessage(),e);
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 import com.skua.modules.edu.entity.Question; 5 import com.skua.modules.edu.entity.Question;
6 import com.baomidou.mybatisplus.extension.service.IService; 6 import com.baomidou.mybatisplus.extension.service.IService;
7 import com.skua.modules.edu.vo.QuestionExcel;
7 8
8 import java.util.List; 9 import java.util.List;
9 10
...@@ -50,4 +51,11 @@ public interface IQuestionService extends IService<Question> { ...@@ -50,4 +51,11 @@ public interface IQuestionService extends IService<Question> {
50 * @return 51 * @return
51 */ 52 */
52 public boolean checkByPaper(String questionId); 53 public boolean checkByPaper(String questionId);
54
55 /**
56 * 批量导入
57 * @param listQuestions
58 * @param dbId
59 */
60 public void batchImportExcel(List<QuestionExcel> listQuestions, String dbId);
53 } 61 }
......
...@@ -10,10 +10,12 @@ import com.skua.modules.edu.entity.QuestionOption; ...@@ -10,10 +10,12 @@ import com.skua.modules.edu.entity.QuestionOption;
10 import com.skua.modules.edu.mapper.QuestionMapper; 10 import com.skua.modules.edu.mapper.QuestionMapper;
11 import com.skua.modules.edu.mapper.QuestionOptionMapper; 11 import com.skua.modules.edu.mapper.QuestionOptionMapper;
12 import com.skua.modules.edu.service.IQuestionService; 12 import com.skua.modules.edu.service.IQuestionService;
13 import com.skua.modules.edu.vo.QuestionExcel;
13 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
14 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 15 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
15 import org.springframework.transaction.annotation.Transactional; 16 import org.springframework.transaction.annotation.Transactional;
16 import javax.annotation.Resource; 17 import javax.annotation.Resource;
18 import java.util.ArrayList;
17 import java.util.List; 19 import java.util.List;
18 20
19 /** 21 /**
...@@ -112,5 +114,38 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i ...@@ -112,5 +114,38 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
112 int count = this.baseMapper.checkByPaper( questionId ); 114 int count = this.baseMapper.checkByPaper( questionId );
113 return count > 0?true:false; 115 return count > 0?true:false;
114 } 116 }
117 /**
118 * 批量导入
119 * @param listQuestions
120 * @param dbId
121 */
122 public void batchImportExcel(List<QuestionExcel> listQuestions, String dbId){
123
124
125 /* // 创建Gson实例
126 Gson gson = new Gson();
127 // 将List转换为Json字符串
128 String questionData = gson.toJson( question.getOptionList() ) ;
129 question.setQuestionData( questionData ) ;*/
130 }
131
132 private Question converQuestion(QuestionExcel questionExcel,String dbId){
133 Question question = new Question();
134 question.setQuestionDbId(dbId);
135 question.setQuestionTitle(questionExcel.getQuestionTitle() );//试题标题
136 question.setAnalyzes(questionExcel.getAnalyzes());//试题解析
137 question.setQuestionType( questionExcel.getQuestionType() );//试题类型
138 question.setQuestionAnswer( questionExcel.getAnswer() );
139
140
141
142 return question;
143 }
144
145 private List<QuestionOption> converQuestionOption(QuestionExcel questionExcel){
146 List<QuestionOption> optionList = new ArrayList<>();
147
148 return optionList;
149 }
115 150
116 } 151 }
......
1 package com.skua.modules.edu.vo;
2
3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty;
5 import lombok.Data;
6 import org.jeecgframework.poi.excel.annotation.Excel;
7
8 /**
9 * @auther kangwei
10 * @create 2025-02-18-13:21
11 */
12 @Data
13 @ApiModel(value="试题批量导入", description="试题批量导入")
14 public class QuestionExcel {
15 /**试题类型:1 单选、2多选、3判断*/
16 @Excel(name = "题型", width = 15)
17 @ApiModelProperty(value = "试题类型:1 单选、2多选、3判断")
18 private String questionType;
19
20 @Excel(name = "题干", width = 15)
21 @ApiModelProperty(value = "试题标题")
22 private String questionTitle;
23
24 @Excel(name = "选项A", width = 15)
25 @ApiModelProperty(value = "选项A")
26 private String optionA;
27
28 @Excel(name = "选项B", width = 15)
29 @ApiModelProperty(value = "选项B")
30 private String optionB;
31
32 @Excel(name = "选项C", width = 15)
33 @ApiModelProperty(value = "选项C")
34 private String optionC;
35
36 @Excel(name = "选项D", width = 15)
37 @ApiModelProperty(value = "选项D")
38 private String optionD;
39 @Excel(name = "选项E", width = 15)
40 @ApiModelProperty(value = "选项E")
41 private String optionE;
42 @Excel(name = "选项F", width = 15)
43 @ApiModelProperty(value = "选项F")
44 private String optionF;
45
46 @Excel(name = "选项G", width = 15)
47 @ApiModelProperty(value = "选项G")
48 private String optionG;
49
50 @Excel(name = "答案", width = 15)
51 @ApiModelProperty(value = "答案")
52 private String answer;
53
54 /**试题解析*/
55 @Excel(name = "试题解析", width = 15)
56 @ApiModelProperty(value = "试题解析")
57 private String analyzes;
58
59
60 }
...@@ -220,8 +220,6 @@ public class ErpSettlementController { ...@@ -220,8 +220,6 @@ public class ErpSettlementController {
220 erpSettlementVO.setApplySign(BaseContextHandler.getUserName()); 220 erpSettlementVO.setApplySign(BaseContextHandler.getUserName());
221 } 221 }
222 erpSettlementService.saveSettlement(erpSettlementVO); 222 erpSettlementService.saveSettlement(erpSettlementVO);
223 //修改药剂入库的状态
224 erpSettlementService.updateMaterialInSettlementFlag( erpSettlementVO,"1");
225 result.success("添加成功!"); 223 result.success("添加成功!");
226 } catch (Exception e) { 224 } catch (Exception e) {
227 log.error(e.getMessage(),e); 225 log.error(e.getMessage(),e);
......
...@@ -91,18 +91,6 @@ public class MaterialINController { ...@@ -91,18 +91,6 @@ public class MaterialINController {
91 private IMaterialAcceptanceFormService materialAcceptanceFormService;//验收单 91 private IMaterialAcceptanceFormService materialAcceptanceFormService;//验收单
92 @Autowired 92 @Autowired
93 private IDistributContractService distributContractService;//分销合同编号 93 private IDistributContractService distributContractService;//分销合同编号
94 /**
95 * <pre>
96 * 分页列表查询
97 * </pre>
98 * @param materialIN
99 * @param pageNo
100 * @param pageSize
101 * @param req
102 * @return
103 * @author 开发者姓名, 开发时间
104 * @Description: TODO(这里描述这个方法的需求变更情况)
105 */
106 94
107 @AutoLog(value = "erp--物料(药剂)入库-分页列表查询") 95 @AutoLog(value = "erp--物料(药剂)入库-分页列表查询")
108 @ApiOperation(value="erp--物料(药剂)入库-分页列表查询", notes="erp--物料(药剂)入库-分页列表查询") 96 @ApiOperation(value="erp--物料(药剂)入库-分页列表查询", notes="erp--物料(药剂)入库-分页列表查询")
...@@ -314,6 +302,24 @@ public class MaterialINController { ...@@ -314,6 +302,24 @@ public class MaterialINController {
314 } 302 }
315 return result; 303 return result;
316 } 304 }
305
306 @AutoLog(value = "erp--物料(药剂)入库-批量送审")
307 @ApiOperation(value="erp--物料(药剂)入库-批量送审", notes="erp--物料(药剂)入库-批量送审")
308 @DeleteMapping(value = "/batchSendAudit")
309 public Result<MaterialIN> batchSendAudit(@RequestParam(name="ids",required=true) String ids) {
310 Result<MaterialIN> result = new Result<MaterialIN>();
311 if(ids==null || "".equals(ids.trim())) {
312 result.error500("参数不识别!");
313 }else {
314 String auditStatus = "1";
315 this.materialINService.batchSendAudit(JSUtils.quoteEach(ids,","),auditStatus);
316 result.success("删除成功!");
317 }
318 return result;
319 }
320
321
322
317 @AutoLog(value = "erp--erp采购合同-审批") 323 @AutoLog(value = "erp--erp采购合同-审批")
318 @ApiOperation(value="erp--采购合同-审批", notes="erp--采购合同-审批") 324 @ApiOperation(value="erp--采购合同-审批", notes="erp--采购合同-审批")
319 @PutMapping(value = "/audit") 325 @PutMapping(value = "/audit")
......
1 package com.skua.modules.erp.controller;
2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 import com.baomidou.mybatisplus.core.metadata.IPage;
5 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 import com.skua.core.api.vo.Result;
7 import com.skua.core.aspect.annotation.AutoLog;
8 import com.skua.core.context.SpringContextUtils;
9 import com.skua.core.query.QueryGenerator;
10 import com.skua.modules.erp.entity.MaterialIN;
11 import com.skua.modules.erp.vo.PurchaseAnalysisVO;
12 import io.swagger.annotations.Api;
13 import io.swagger.annotations.ApiOperation;
14 import lombok.extern.slf4j.Slf4j;
15 import org.springframework.jdbc.core.JdbcTemplate;
16 import org.springframework.web.bind.annotation.GetMapping;
17 import org.springframework.web.bind.annotation.RequestMapping;
18 import org.springframework.web.bind.annotation.RequestParam;
19 import org.springframework.web.bind.annotation.RestController;
20
21 import javax.servlet.http.HttpServletRequest;
22
23 /**
24 * 采购数据分析
25 * @auther kangwei
26 * @create 2025-02-19-14:07
27 */
28 @Slf4j
29 @Api(tags="erp-药剂采购分析")
30 @RestController("purchaseAnalysisController")
31 @RequestMapping("/web/erp/purchaseAnalysis")
32 public class PurchaseAnalysisController {
33
34 @AutoLog(value = "erp-药剂采购分析")
35 @ApiOperation(value="erp--药剂采购分析", notes="erp--药剂采购分析")
36 @GetMapping(value = "/analysis")
37 public Result<PurchaseAnalysisVO> settlementList(String startDate,String endDate) {
38 Result<PurchaseAnalysisVO> result = new Result<PurchaseAnalysisVO>();
39
40 String drugStorage = getJdbcTemplate().queryForObject("select round(ifnull(sum(material_num),0),2) from erp_material_in where audit_status = '3' and arrive_time >='"+startDate+"' and arrive_time <= '"+endDate+"'",String.class);
41 String purchaseMoney = getJdbcTemplate().queryForObject("select round(ifnull(sum(purchase_money),0),2) from erp_purchase_contract where use_flag = 0 and status = 3 and project_time >='"+startDate+"' and project_time <= '"+endDate+"'",String.class);
42 String distributMoney = getJdbcTemplate().queryForObject("select round(ifnull(sum(distribut_money),0),2) from erp_distribut_contract where status = 3 and purchase_time >='"+startDate+"' and purchase_time <= '"+endDate+"' ",String.class);
43 String supplierMoneyByJs = getJdbcTemplate().queryForObject("select round(ifnull(sum(t.total_price_tax),0),2) from erp_settlement t where t.settlement_type = '0' and t.status = '1' and settlement_time >='"+startDate+"' and settlement_time<='"+endDate+"' ",String.class);
44 String waterDepartMoneyByJs = getJdbcTemplate().queryForObject("select round(ifnull(sum(t.total_price_tax),0),2) from erp_settlement t where t.settlement_type = '1' and t.status = '1' and settlement_time >='"+startDate+"' and settlement_time<='"+endDate+"' ",String.class);
45
46 PurchaseAnalysisVO purchaseAnalysisVO = new PurchaseAnalysisVO( drugStorage, purchaseMoney, distributMoney, supplierMoneyByJs, waterDepartMoneyByJs);
47 result.setSuccess(true);
48 result.setResult(purchaseAnalysisVO);
49 return result;
50 }
51 private JdbcTemplate getJdbcTemplate(){
52 JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master");
53 return jdbcTemplate;
54 }
55 }
...@@ -137,6 +137,7 @@ public class MaterialIN { ...@@ -137,6 +137,7 @@ public class MaterialIN {
137 @ApiModelProperty(value = "申请人") 137 @ApiModelProperty(value = "申请人")
138 private String applyUser; 138 private String applyUser;
139 139
140
140 /**入库类型*/ 141 /**入库类型*/
141 @ApiModelProperty(value = "入库类型") 142 @ApiModelProperty(value = "入库类型")
142 private String inType; 143 private String inType;
......
...@@ -29,4 +29,10 @@ public interface DistributContractMapper extends BaseMapper<DistributContract> { ...@@ -29,4 +29,10 @@ public interface DistributContractMapper extends BaseMapper<DistributContract> {
29 * @return 29 * @return
30 */ 30 */
31 List<String> selectIdsByCode(@Param("contractCode") String contractCode); 31 List<String> selectIdsByCode(@Param("contractCode") String contractCode);
32
33 /***
34 * 修改分销合同的分销价格
35 * @param contractId
36 */
37 void updateDistributMoney(String contractId);
32 } 38 }
......
...@@ -31,4 +31,12 @@ public interface MaterialINMapper extends BaseMapper<MaterialIN> { ...@@ -31,4 +31,12 @@ public interface MaterialINMapper extends BaseMapper<MaterialIN> {
31 31
32 @Anonymous 32 @Anonymous
33 public MaterialIN queryById(@Param("id") String id); 33 public MaterialIN queryById(@Param("id") String id);
34
35 /**
36 * 批量送审
37 * @param ids
38 * @param auditStatus
39 * @return
40 */
41 public int batchSendAudit(@Param("id")String ids, @Param("auditStatus")String auditStatus);
34 } 42 }
......
...@@ -15,5 +15,9 @@ ...@@ -15,5 +15,9 @@
15 <select id="selectIdsByCode" resultType="java.lang.String"> 15 <select id="selectIdsByCode" resultType="java.lang.String">
16 select id from erp_distribut_contract where contract_code like CONCAT('%',#{contractCode},'%') 16 select id from erp_distribut_contract where contract_code like CONCAT('%',#{contractCode},'%')
17 </select> 17 </select>
18 <!-- 修改分销合同的分销价格-->
19 <update id="updateDistributMoney">
20 update erp_distribut_contract dc set distribut_money = (select sum(dm.distribut_total_price) from erp_distribut_material dm where dm.contract_id = dc.id ) where dc.id = #{contractId}
21 </update>
18 22
19 </mapper> 23 </mapper>
......
...@@ -67,4 +67,8 @@ ...@@ -67,4 +67,8 @@
67 left join ajh_supplier_manage sm on sm.id = t.supplier_id 67 left join ajh_supplier_manage sm on sm.id = t.supplier_id
68 where t.id = #{id} 68 where t.id = #{id}
69 </select> 69 </select>
70 <!-- 批量送审-->
71 <update id="batchSendAudit" >
72 update erp_material_in set audit_status = #{auditStatus} where id in (${ids}) and audit_status = '0'
73 </update>
70 </mapper> 74 </mapper>
......
...@@ -57,4 +57,11 @@ public interface IMaterialINService extends IService<MaterialIN> { ...@@ -57,4 +57,11 @@ public interface IMaterialINService extends IService<MaterialIN> {
57 * @param ids 57 * @param ids
58 */ 58 */
59 String auditBatchMaterialINVO(String ids , String approveState,String approveMessage)throws Exception; 59 String auditBatchMaterialINVO(String ids , String approveState,String approveMessage)throws Exception;
60
61 /***
62 * 批量送审
63 * @param ids
64 * @return
65 */
66 public int batchSendAudit(String ids,String auditStatus);
60 } 67 }
......
...@@ -113,6 +113,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM ...@@ -113,6 +113,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM
113 materialMapper.insert( material ); 113 materialMapper.insert( material );
114 } 114 }
115 } 115 }
116 baseMapper.updateDistributMoney(distributContractVO.getId());//修改分销合同的分销价格
116 return null; 117 return null;
117 } 118 }
118 119
...@@ -136,6 +137,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM ...@@ -136,6 +137,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM
136 materialMapper.insert( material ); 137 materialMapper.insert( material );
137 } 138 }
138 } 139 }
140 baseMapper.updateDistributMoney(distributContractVO.getId());//修改分销合同的分销价格
139 return null; 141 return null;
140 } 142 }
141 /** 143 /**
......
...@@ -58,6 +58,8 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E ...@@ -58,6 +58,8 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
58 settlementItemMapper.insert( settlementItem) ; 58 settlementItemMapper.insert( settlementItem) ;
59 } 59 }
60 } 60 }
61 //修改药剂入库的状态
62 updateMaterialInSettlementFlag( erpSettlementVO,"1");
61 } 63 }
62 64
63 /** 65 /**
......
...@@ -87,6 +87,14 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia ...@@ -87,6 +87,14 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
87 return sb.toString(); 87 return sb.toString();
88 } 88 }
89 /*** 89 /***
90 * 批量送审
91 * @param ids
92 * @return
93 */
94 public int batchSendAudit(String ids,String auditStatus){
95 return this.baseMapper.batchSendAudit(ids,auditStatus);
96 }
97 /***
90 * 审核药剂入库单 98 * 审核药剂入库单
91 * @param materialINVO 99 * @param materialINVO
92 */ 100 */
......
1 package com.skua.modules.erp.vo;
2
3 import com.skua.tool.util.JSUtils;
4 import io.swagger.annotations.ApiModel;
5 import io.swagger.annotations.ApiModelProperty;
6 import lombok.Data;
7 /**
8 * @auther kangwei
9 * @create 2025-02-19-14:09
10 */
11 @Data
12 @ApiModel(value="药剂采购分析结果", description="药剂采购分析结果")
13 public class PurchaseAnalysisVO {
14 @ApiModelProperty(value = "药剂入库量(吨)")
15 private String drugStorage;//
16
17 @ApiModelProperty(value = "采购总额")
18 private String purchaseMoney;
19
20 @ApiModelProperty(value = "分销总额")
21 private String distributMoney;
22
23 @ApiModelProperty(value = "供应商结算金额")
24 private String supplierMoneyByJs;
25
26 @ApiModelProperty(value = "水务公司结算金额")
27 private String waterDepartMoneyByJs;
28
29
30 public PurchaseAnalysisVO(){
31 }
32
33 public PurchaseAnalysisVO(String drugStorage, String purchaseMoney, String distributMoney, String supplierMoneyByJs, String waterDepartMoneyByJs) {
34 this.drugStorage = JSUtils.convertStringToInt(drugStorage);
35 this.purchaseMoney = JSUtils.convertStringToInt(purchaseMoney);
36 this.distributMoney = JSUtils.convertStringToInt(distributMoney);
37 this.supplierMoneyByJs = JSUtils.convertStringToInt(supplierMoneyByJs);
38 this.waterDepartMoneyByJs = JSUtils.convertStringToInt(waterDepartMoneyByJs);
39 }
40 }
...@@ -33,24 +33,27 @@ public class WorkAnalysisController { ...@@ -33,24 +33,27 @@ public class WorkAnalysisController {
33 33
34 @ApiOperation(value = "工作进度列表", notes = "工作进度列表 departType = 1 自营水厂 departType=2 表示恩菲水厂 timeType = 1 表示月份,timeType=2 表示年") 34 @ApiOperation(value = "工作进度列表", notes = "工作进度列表 departType = 1 自营水厂 departType=2 表示恩菲水厂 timeType = 1 表示月份,timeType=2 表示年")
35 @GetMapping("/analysisByWorkProgress") 35 @GetMapping("/analysisByWorkProgress")
36 public Result<List<WorkProgressVO>> analysisByWorkProgress(@RequestParam(defaultValue = "1") Integer departType,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) { 36 public Result<List<WorkProgressVO>> analysisByWorkProgress(@RequestParam(defaultValue = "1") Integer departType, String departId, @RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
37 Result<List<WorkProgressVO>> result = new Result<>(); 37 Result<List<WorkProgressVO>> result = new Result<>();
38 String month = DateUtils.formatDate(startTime,"YYYY-MM"); 38 String month = DateUtils.formatDate(startTime,"YYYY-MM");
39 if(2 == timeType){//表示年 39 if(2 == timeType){//表示年
40 month = DateUtils.formatDate(startTime,"YYYY"); 40 month = DateUtils.formatDate(startTime,"YYYY");
41 } 41 }
42 String departIds = null;//DAY(LAST_DAY('"+startTime+"')) 42 String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
43 if(departType == 1){//自营水厂 43 if(StringUtils.isEmpty(departId )){
44 departIds = getSelfDepartIds(); 44 if(departType == 1){//自营水厂
45 } 45 departIds = getSelfDepartIds();
46 if(departType == 2){//恩菲水厂 46 }
47 departIds = getEFDepartIds(); 47 if(departType == 2){//恩菲水厂
48 departIds = getEFDepartIds();
49 }
48 } 50 }
51
49 String sql = "select d.id 'depart_id' , d.depart_name , (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"') + 1) month_num,ifnull(aaa.count,0) 'nh_num' ,ifnull(bbb.count,0) 'szsl_num' ,ifnull(ccc.count,0) 'hy_num' ,ifnull(ddd.count,0) 'yy_month_num',ifnull(fff.count,0) 'df_month_num' ,ifnull(ggg.count,0) 'year_target_num' from sys_depart d "; 52 String sql = "select d.id 'depart_id' , d.depart_name , (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"') + 1) month_num,ifnull(aaa.count,0) 'nh_num' ,ifnull(bbb.count,0) 'szsl_num' ,ifnull(ccc.count,0) 'hy_num' ,ifnull(ddd.count,0) 'yy_month_num',ifnull(fff.count,0) 'df_month_num' ,ifnull(ggg.count,0) 'year_target_num' from sys_depart d ";
50 sql += getWorkProgressSql(departIds, startTime, endTime, month); 53 sql += getWorkProgressSql(departIds, startTime, endTime, month);
51 sql += " where d.depart_type =1 "; 54 sql += " where d.depart_type =1 ";
52 if(StringUtils.isNotEmpty(departIds)){ 55 if(StringUtils.isNotEmpty(departIds)){
53 sql += " d.id in ("+ JSUtils.quoteEach(departIds,",") +")"; 56 sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")";
54 } 57 }
55 sql += " order by (ifnull(aaa.count,0) + ifnull(bbb.count,0)+ifnull(ccc.count,0) +ifnull(ddd.count,0)+ifnull(fff.count,0) +ifnull(ggg.count,0) ) asc "; 58 sql += " order by (ifnull(aaa.count,0) + ifnull(bbb.count,0)+ifnull(ccc.count,0) +ifnull(ddd.count,0)+ifnull(fff.count,0) +ifnull(ggg.count,0) ) asc ";
56 59
...@@ -64,19 +67,21 @@ public class WorkAnalysisController { ...@@ -64,19 +67,21 @@ public class WorkAnalysisController {
64 67
65 @ApiOperation(value = "工作进度统计-数量统计", notes = "工作进度-数量统计 timeType = 1 表示月份,timeType=2 表示年") 68 @ApiOperation(value = "工作进度统计-数量统计", notes = "工作进度-数量统计 timeType = 1 表示月份,timeType=2 表示年")
66 @GetMapping("/analysisTotalByWorkProgress") 69 @GetMapping("/analysisTotalByWorkProgress")
67 public Result<WorkProgressVO> analysisTotalByWorkProgress(@RequestParam(defaultValue = "1") Integer departType,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) { 70 public Result<WorkProgressVO> analysisTotalByWorkProgress(@RequestParam(defaultValue = "1") Integer departType, String departId, @RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
68 Result<WorkProgressVO> result = new Result<>(); 71 Result<WorkProgressVO> result = new Result<>();
69 WorkProgressVO workProgressVO = null; 72 WorkProgressVO workProgressVO = null;
70 String month = DateUtils.formatDate(startTime,"YYYY-MM"); 73 String month = DateUtils.formatDate(startTime,"YYYY-MM");
71 if(2 == timeType){//表示年 74 if(2 == timeType){//表示年
72 month = DateUtils.formatDate(startTime,"YYYY"); 75 month = DateUtils.formatDate(startTime,"YYYY");
73 } 76 }
74 String departIds = null;//DAY(LAST_DAY('"+startTime+"')) 77 String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
75 if(departType == 1){//自营水厂 78 if(StringUtils.isEmpty(departId )){
76 departIds = getSelfDepartIds(); 79 if(departType == 1){//自营水厂
77 } 80 departIds = getSelfDepartIds();
78 if(departType == 2){//恩菲水厂 81 }
79 departIds = getEFDepartIds(); 82 if(departType == 2){//恩菲水厂
83 departIds = getEFDepartIds();
84 }
80 } 85 }
81 String sql = "select count(d.id) 'departNum', (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"') + 1) month_num,"; 86 String sql = "select count(d.id) 'departNum', (DATEDIFF('"+endTime+"', '"+startTime+"') +1) 'day_num' , (month('"+endTime+"') - month('"+startTime+"') + 1) month_num,";
82 sql += " ifnull(sum(aaa.count),0) 'nh_num' ,ifnull(sum(bbb.count),0) 'szsl_num' ,ifnull(sum(ccc.count),0) 'hy_num' ,ifnull(sum(ddd.count),0) 'yy_month_num',ifnull(sum(fff.count),0) 'df_month_num' ,ifnull(sum(ggg.count),0) 'year_target_num' "; 87 sql += " ifnull(sum(aaa.count),0) 'nh_num' ,ifnull(sum(bbb.count),0) 'szsl_num' ,ifnull(sum(ccc.count),0) 'hy_num' ,ifnull(sum(ddd.count),0) 'yy_month_num',ifnull(sum(fff.count),0) 'df_month_num' ,ifnull(sum(ggg.count),0) 'year_target_num' ";
...@@ -84,11 +89,10 @@ public class WorkAnalysisController { ...@@ -84,11 +89,10 @@ public class WorkAnalysisController {
84 sql += getWorkProgressSql(departIds, startTime, endTime, month); 89 sql += getWorkProgressSql(departIds, startTime, endTime, month);
85 sql += " where d.depart_type =1 "; 90 sql += " where d.depart_type =1 ";
86 if(StringUtils.isNotEmpty(departIds)){ 91 if(StringUtils.isNotEmpty(departIds)){
87 sql += " d.id in ("+ JSUtils.quoteEach(departIds,",") +")"; 92 sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")";
88 } 93 }
89 System.out.println("sql = "+sql); 94 System.out.println("sql = "+sql);
90 JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master"); 95 List<WorkProgressVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WorkProgressVO>(WorkProgressVO.class));
91 List<WorkProgressVO> dataList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<WorkProgressVO>(WorkProgressVO.class));
92 if(dataList != null && !dataList.isEmpty()){ 96 if(dataList != null && !dataList.isEmpty()){
93 workProgressVO = dataList.get(0); 97 workProgressVO = dataList.get(0);
94 } 98 }
...@@ -100,51 +104,54 @@ public class WorkAnalysisController { ...@@ -100,51 +104,54 @@ public class WorkAnalysisController {
100 104
101 @ApiOperation(value = "安全管理进度-数据列表", notes = "安全管理进度-数据列表 timeType = 1 表示月份,timeType=2 表示年") 105 @ApiOperation(value = "安全管理进度-数据列表", notes = "安全管理进度-数据列表 timeType = 1 表示月份,timeType=2 表示年")
102 @GetMapping("/analysisBySafeProgress") 106 @GetMapping("/analysisBySafeProgress")
103 public Result<List<SafeProgressVO>> analysisBySafeProgress(@RequestParam(defaultValue = "1") Integer departType,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) { 107 public Result<List<SafeProgressVO>> analysisBySafeProgress(@RequestParam(defaultValue = "1") Integer departType,String departId,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
104 Result<List<SafeProgressVO>> result = new Result<>(); 108 Result<List<SafeProgressVO>> result = new Result<>();
105 JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master"); 109 JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master");
106 String departIds = null; 110 String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
107 if(departType == 1){//自营水厂 111 if(StringUtils.isEmpty(departId )){
108 departIds = getSelfDepartIds(); 112 if(departType == 1){//自营水厂
109 } 113 departIds = getSelfDepartIds();
110 if(departType == 2){//恩菲水厂 114 }
111 departIds = getEFDepartIds(); 115 if(departType == 2){//恩菲水厂
116 departIds = getEFDepartIds();
117 }
112 } 118 }
113 String sql = "select d.id 'depart_id' , d.depart_name , ifnull(aaa.count,0) 'meet_num', ifnull(bbb.count,0) 'meet_total', ifnull(ccc.count,0) 'exam_num', ifnull(ddd.count,0) 'exam_total',ifnull(eee.count, 0) 'frequency_num' , ifnull(fff.count , 0) 'frequency_total'"; 119 String sql = "select d.id 'depart_id' , d.depart_name , ifnull(aaa.count,0) 'meet_num', ifnull(bbb.count,0) 'meet_total', ifnull(ccc.count,0) 'exam_num', ifnull(ddd.count,0) 'exam_total',ifnull(eee.count, 0) 'frequency_num' , ifnull(fff.count , 0) 'frequency_total'";
114 sql += " from sys_depart d "; 120 sql += " from sys_depart d ";
115 sql += getSafeProgressSql(departIds, startTime,endTime); 121 sql += getSafeProgressSql(departIds, startTime,endTime);
116 sql += " where d.depart_type =1 "; 122 sql += " where d.depart_type =1 ";
117 if(StringUtils.isNotEmpty(departIds)){ 123 if(StringUtils.isNotEmpty(departIds)){
118 sql += " d.id in ("+ JSUtils.quoteEach(departIds,",") +")"; 124 sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")";
119 } 125 }
120 sql += " order by (ifnull(aaa.count,0) + ifnull(bbb.count,0) + ifnull(ccc.count,0) + ifnull(ddd.count,0) + ifnull(fff.count,0) ) asc "; 126 sql += " order by (ifnull(aaa.count,0) + ifnull(bbb.count,0) + ifnull(ccc.count,0) + ifnull(ddd.count,0) + ifnull(fff.count,0) ) asc ";
121 System.out.println("sql = "+sql); 127 System.out.println("sql = "+sql);
122 List<SafeProgressVO> dataList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<SafeProgressVO>(SafeProgressVO.class)); 128 List<SafeProgressVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<SafeProgressVO>(SafeProgressVO.class));
123 result.setResult(dataList); 129 result.setResult(dataList);
124 result.setSuccess(true); 130 result.setSuccess(true);
125 return result; 131 return result;
126 } 132 }
127 @ApiOperation(value = "安全管理进度统计-数量统计", notes = "安全管理进度-数量统计 timeType = 1 表示月份,timeType=2 表示年") 133 @ApiOperation(value = "安全管理进度统计-数量统计", notes = "安全管理进度-数量统计 timeType = 1 表示月份,timeType=2 表示年")
128 @GetMapping("/analysisTotalBySafeProgress") 134 @GetMapping("/analysisTotalBySafeProgress")
129 public Result<SafeProgressVO> analysisTotalBySafeProgress(@RequestParam(defaultValue = "1") Integer departType,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) { 135 public Result<SafeProgressVO> analysisTotalBySafeProgress(@RequestParam(defaultValue = "1") Integer departType, String departId ,@RequestParam(defaultValue = "1") Integer timeType, String startTime, String endTime) {
130 Result<SafeProgressVO> result = new Result<>(); 136 Result<SafeProgressVO> result = new Result<>();
131 String departIds = null;//DAY(LAST_DAY('"+startTime+"')) 137 String departIds = departId;//DAY(LAST_DAY('"+startTime+"'))
132 if(departType == 1){//自营水厂 138 if(StringUtils.isEmpty(departId )){
133 departIds = getSelfDepartIds(); 139 if(departType == 1){//自营水厂
134 } 140 departIds = getSelfDepartIds();
135 if(departType == 2){//恩菲水厂 141 }
136 departIds = getEFDepartIds(); 142 if(departType == 2){//恩菲水厂
143 departIds = getEFDepartIds();
144 }
137 } 145 }
138 String sql = "select count(d.id) 'departNum', ifnull(sum(aaa.count),0) 'meet_num' ,ifnull(sum(bbb.count),0) 'meet_total' ,ifnull(sum(ccc.count),0) 'exam_num' ,ifnull(sum(ddd.count),0) 'exam_total',ifnull(sum(eee.count),0) 'frequency_num' ,ifnull(sum(fff.count),0) 'frequency_total' "; 146 String sql = "select count(d.id) 'departNum', ifnull(sum(aaa.count),0) 'meet_num' ,ifnull(sum(bbb.count),0) 'meet_total' ,ifnull(sum(ccc.count),0) 'exam_num' ,ifnull(sum(ddd.count),0) 'exam_total',ifnull(sum(eee.count),0) 'frequency_num' ,ifnull(sum(fff.count),0) 'frequency_total' ";
139 sql += " from sys_depart d "; 147 sql += " from sys_depart d ";
140 sql += getSafeProgressSql(departIds, startTime,endTime); 148 sql += getSafeProgressSql(departIds, startTime,endTime);
141 sql += " where d.depart_type =1 "; 149 sql += " where d.depart_type =1 ";
142 if(StringUtils.isNotEmpty(departIds)){ 150 if(StringUtils.isNotEmpty(departIds)){
143 sql += " d.id in ("+ JSUtils.quoteEach(departIds,",") +")"; 151 sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")";
144 } 152 }
145 System.out.println("sql = "+sql); 153 System.out.println("sql = "+sql);
146 JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtils.getBean("master"); 154 List<SafeProgressVO> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<SafeProgressVO>(SafeProgressVO.class));
147 List<SafeProgressVO> dataList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<SafeProgressVO>(SafeProgressVO.class));
148 if(dataList != null && !dataList.isEmpty()){ 155 if(dataList != null && !dataList.isEmpty()){
149 result.setResult(dataList.get(0)); 156 result.setResult(dataList.get(0));
150 result.setSuccess(true); 157 result.setSuccess(true);
...@@ -176,31 +183,36 @@ public class WorkAnalysisController { ...@@ -176,31 +183,36 @@ public class WorkAnalysisController {
176 183
177 private String getWorkProgressSql( String departIds,String startTime, String endTime,String month){ 184 private String getWorkProgressSql( String departIds,String startTime, String endTime,String month){
178 String sql = ""; 185 String sql = "";
179 //能耗日报 186 //能耗日报: 污泥量、电量合计,用水量
180 String view3a24Sql = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ",departIds,startTime,endTime); 187 String view3a24Sql = ReportViewUtil.buildView(ReportConstant.view3a24,"WNL,DLHJ,YSL",departIds,startTime,endTime);
181 sql += " left join (select aa.depart_id ,count(1) 'count' from "+view3a24Sql+ " aa group by aa.depart_id )aaa on aaa.depart_id = d.id "; 188 sql += " left join (select aa.depart_id ,count(1) 'count' from "+view3a24Sql+ " aa where aa.WNL is not null and aa.WNL <> '' and aa.DLHJ is not null and aa.DLHJ <> '' and aa.YSL is not null and aa.YSL <> '' group by aa.depart_id )aaa on aaa.depart_id = d.id ";
182 //水质水量日报表 189 //水质水量日报表:进水量、出水量、PH进水、PH出水、COD进水、COD出水,TP进水、TP出水、NH4-N进水、出水; TN进水、出水
183 String view2119Sql = ReportViewUtil.buildView(ReportConstant.view2119,"CSL",departIds,startTime,endTime); 190 String view2119Sql = ReportViewUtil.buildView(ReportConstant.view2119,"JSL,CSL,JSAD,CSAD,JSZD,CSTN,JSZL,CSZL,JSCOD,CSCOD,JSPH,CSPH",departIds,startTime,endTime);
184 sql += " left join ( select bb.depart_id ,count(1) 'count' from "+view2119Sql+ " bb group by bb.depart_id )bbb on bbb.depart_id = d.id "; 191 sql += " left join ( select bb.depart_id ,count(1) 'count' from "+view2119Sql+ " bb ";
185 192 sql += " where bb.JSL is not null and bb.JSL <> '' and bb.CSL is not null and bb.CSL <> '' and bb.JSAD is not null and bb.JSAD <> '' and bb.CSAD is not null and bb.CSAD <> '' ";
186 //化验日报 193 sql += " and bb.JSZD is not null and bb.JSZD <> '' and bb.CSTN is not null and bb.CSTN <> '' and bb.JSZL is not null and bb.JSZL <> '' and bb.CSZL is not null and bb.CSZL <> '' ";
187 String viewbffaSql = ReportViewUtil.buildView(ReportConstant.view9bff,"JSCODHY",departIds,startTime,endTime); 194 sql += " and bb.JSCOD is not null and bb.JSCOD <> '' and bb.CSCOD is not null and bb.CSCOD <> '' and bb.JSPH is not null and bb.JSPH <> '' and bb.CSPH is not null and bb.CSPH <> '' ";
188 sql += " left join (select cc.depart_id ,count(1) 'count' from "+viewbffaSql+ " cc group by cc.depart_id )ccc on ccc.depart_id = d.id "; 195 sql += " group by bb.depart_id )bbb on bbb.depart_id = d.id ";
189 196
197 //化验日报 ==化验数据:PH进水、PH出水、COD进水、COD出水、TP进水、TP出水、NH4-N进水、出水; TN进水、出水
198 String viewbffaSql = ReportViewUtil.buildView(ReportConstant.view9bff,"JSPHHY,CSPHHY,JSCODHY,CSCODHY,JSZLHY,CSZLHY,CSTNHY,JSZDHY,JSADHY,CSADHY",departIds,startTime,endTime);
199 sql += " left join (select cc.depart_id ,count(1) 'count' from "+viewbffaSql+ " cc ";
200 sql += " where cc.JSPHHY is not null and cc.JSPHHY <> '' and cc.CSPHHY is not null and cc.CSPHHY <> '' and cc.JSCODHY is not null and cc.JSCODHY <> '' and cc.CSCODHY is not null and cc.CSCODHY <> '' ";
201 sql += " and cc.JSZLHY is not null and cc.JSZLHY <> '' and cc.CSZLHY is not null and cc.CSZLHY <> '' and cc.CSTNHY is not null and cc.CSTNHY <> '' and cc.JSZDHY is not null and cc.JSZDHY <> '' ";
202 sql += " and cc.JSADHY is not null and cc.JSADHY <> '' and cc.CSADHY is not null and cc.CSADHY <> '' ";
203 sql += " group by cc.depart_id )ccc on ccc.depart_id = d.id ";
190 //电费月报 204 //电费月报
191 sql += " left join( select ec.depart_id , ec.cost , count(1) 'count' from report_electric_cost ec where ec.month like '"+month+"%' and ec.cost > '0' group by ec.depart_id ) ddd on ddd.depart_id = d.id "; 205 sql += " left join( select ec.depart_id , count(1) 'count' from report_electric_cost ec where ec.month = '"+month+"' and ec.cost is not null and ec.cost <> '' group by ec.depart_id ) ddd on ddd.depart_id = d.id ";
192 206
193 //生产运营月报表 207 //生产运营月报表:月收费水量、月药费
194 String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime); 208 String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime);
195 sql += " left join (select eee.depart_id ,count(1) 'count' from (select left(ee.time,7) time , ee.depart_id from "+view4411Sql+ " ee where 1=1 group by ee.depart_id ,left(ee.time,7) HAVING ifnull(sum(ee.yyf),0) >0 and ifnull(sum(ee.ysfsl),0) > 0 )eee group by eee.depart_id )fff on fff.depart_id = d.id "; 209 sql += " left join (select eee.depart_id ,count(1) 'count' from (select left(ee.time,7) time , ee.depart_id from "+view4411Sql+ " ee where 1=1 and ee.yyf is not null and ee.yyf <> '' and ee.ysfsl is not null and ee.ysfsl <> '' group by ee.depart_id ,left(ee.time,7) )eee group by eee.depart_id )fff on fff.depart_id = d.id ";
196 210 sql += " ";
197 //目标年报 211 //目标年报
198 sql += " left join(select depart_id ,count(depart_id) 'count' from report_target_config where target_year = year('"+startTime+"') group by depart_id) ggg on ggg.depart_id = d.id "; 212 sql += " left join(select depart_id ,count(depart_id) 'count' from report_target_config where target_year = year('"+startTime+"') group by depart_id) ggg on ggg.depart_id = d.id ";
199
200 return sql; 213 return sql;
201 } 214 }
202 215
203
204 private String getSelfDepartIds(){ 216 private String getSelfDepartIds(){
205 String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id <> '1818215543140909056'"; 217 String sql = "select GROUP_CONCAT(id) 'departIds' from sys_depart where depart_type =1 and parent_id <> '1818215543140909056'";
206 return getJdbcTemplate().queryForObject(sql,String.class); 218 return getJdbcTemplate().queryForObject(sql,String.class);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!