1.增加船只直观图展示功能

master
董哲奇 1 year ago
parent 68d550450a
commit 8c1eeb3d91

@ -0,0 +1,45 @@
package com.dsic.gj_erp.bean.fd;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DmCzfddyb {
private String czbh;//船只编号
private String fdh;//分段号
private String qy;//所属区域
private Integer frow;//行
private Integer fcol;//列
private String zydw;//作业单位
private String zycj;//作业车间
private String stjhrq;//上胎计划期
private String zzjhrq;//总组计划期
private String dzjhrq;//大组计划期
private String xzjhrq;//小组计划期
private String kgrq;//开工日期
private String wgrq;//完工日期
private Integer tpzs;//托盘总数
private String zt;//"状态"
private String bz;//备注
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
}

@ -0,0 +1,31 @@
package com.dsic.gj_erp.bean.fd;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class DmXqdwcjcd implements Serializable {
private static final long serialVersionUID=1L;
private String cdmc;
private String dwbm;
private String bz;
private String dh;
@TableId(value = "cdid", type = IdType.ASSIGN_UUID)
private String cdid;
private String cdlx;
private String cjmc;
private String fzry;
}

@ -0,0 +1,253 @@
package com.dsic.gj_erp.bean.fd;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ExcelExport {
@ExcelProperty(index = 0)
private String column000;
@ExcelProperty(index = 1)
private String column001;
@ExcelProperty(index = 2)
private String column002;
@ExcelProperty(index = 3)
private String column003;
@ExcelProperty(index = 4)
private String column004;
@ExcelProperty(index = 5)
private String column005;
@ExcelProperty(index = 6)
private String column006;
@ExcelProperty(index = 7)
private String column007;
@ExcelProperty(index = 8)
private String column008;
@ExcelProperty(index = 9)
private String column009;
@ExcelProperty(index = 10)
private String column010;
@ExcelProperty(index = 11)
private String column011;
@ExcelProperty(index = 12)
private String column012;
@ExcelProperty(index = 13)
private String column013;
@ExcelProperty(index = 14)
private String column014;
@ExcelProperty(index = 15)
private String column015;
@ExcelProperty(index = 16)
private String column016;
@ExcelProperty(index = 17)
private String column017;
@ExcelProperty(index = 18)
private String column018;
@ExcelProperty(index = 19)
private String column019;
@ExcelProperty(index = 20)
private String column020;
@ExcelProperty(index = 21)
private String column021;
@ExcelProperty(index = 22)
private String column022;
@ExcelProperty(index = 23)
private String column023;
@ExcelProperty(index = 24)
private String column024;
@ExcelProperty(index = 25)
private String column025;
@ExcelProperty(index = 26)
private String column026;
@ExcelProperty(index = 27)
private String column027;
@ExcelProperty(index = 28)
private String column028;
@ExcelProperty(index = 29)
private String column029;
@ExcelProperty(index = 30)
private String column030;
@ExcelProperty(index = 31)
private String column031;
@ExcelProperty(index = 32)
private String column032;
@ExcelProperty(index = 33)
private String column033;
@ExcelProperty(index = 34)
private String column034;
@ExcelProperty(index = 35)
private String column035;
@ExcelProperty(index = 36)
private String column036;
@ExcelProperty(index = 37)
private String column037;
@ExcelProperty(index = 38)
private String column038;
@ExcelProperty(index = 39)
private String column039;
@ExcelProperty(index = 40)
private String column040;
@ExcelProperty(index = 41)
private String column041;
@ExcelProperty(index = 42)
private String column042;
@ExcelProperty(index = 43)
private String column043;
@ExcelProperty(index = 44)
private String column044;
@ExcelProperty(index = 45)
private String column045;
@ExcelProperty(index = 46)
private String column046;
@ExcelProperty(index = 47)
private String column047;
@ExcelProperty(index = 48)
private String column048;
@ExcelProperty(index = 49)
private String column049;
@ExcelProperty(index = 50)
private String column050;
@ExcelProperty(index = 51)
private String column051;
@ExcelProperty(index = 52)
private String column052;
@ExcelProperty(index = 53)
private String column053;
@ExcelProperty(index = 54)
private String column054;
@ExcelProperty(index = 55)
private String column055;
@ExcelProperty(index = 56)
private String column056;
@ExcelProperty(index = 57)
private String column057;
@ExcelProperty(index = 58)
private String column058;
@ExcelProperty(index = 59)
private String column059;
@ExcelProperty(index = 60)
private String column060;
@ExcelProperty(index = 61)
private String column061;
@ExcelProperty(index = 62)
private String column062;
@ExcelProperty(index = 63)
private String column063;
@ExcelProperty(index = 64)
private String column064;
@ExcelProperty(index = 65)
private String column065;
@ExcelProperty(index = 66)
private String column066;
@ExcelProperty(index = 67)
private String column067;
@ExcelProperty(index = 68)
private String column068;
@ExcelProperty(index = 69)
private String column069;
@ExcelProperty(index = 70)
private String column070;
@ExcelProperty(index = 71)
private String column071;
@ExcelProperty(index = 72)
private String column072;
@ExcelProperty(index = 73)
private String column073;
@ExcelProperty(index = 74)
private String column074;
@ExcelProperty(index = 75)
private String column075;
@ExcelProperty(index = 76)
private String column076;
@ExcelProperty(index = 77)
private String column077;
@ExcelProperty(index = 78)
private String column078;
@ExcelProperty(index = 79)
private String column079;
@ExcelProperty(index = 80)
private String column080;
@ExcelProperty(index = 81)
private String column081;
@ExcelProperty(index = 82)
private String column082;
@ExcelProperty(index = 83)
private String column083;
@ExcelProperty(index = 84)
private String column084;
@ExcelProperty(index = 85)
private String column085;
@ExcelProperty(index = 86)
private String column086;
@ExcelProperty(index = 87)
private String column087;
@ExcelProperty(index = 88)
private String column088;
@ExcelProperty(index = 89)
private String column089;
@ExcelProperty(index = 90)
private String column090;
@ExcelProperty(index = 91)
private String column091;
@ExcelProperty(index = 92)
private String column092;
@ExcelProperty(index = 93)
private String column093;
@ExcelProperty(index = 94)
private String column094;
@ExcelProperty(index = 95)
private String column095;
@ExcelProperty(index = 96)
private String column096;
@ExcelProperty(index = 97)
private String column097;
@ExcelProperty(index = 98)
private String column098;
@ExcelProperty(index = 99)
private String column099;
@ExcelProperty(index = 100)
private String column100;
@ExcelProperty(index = 101)
private String column101;
@ExcelProperty(index = 102)
private String column102;
@ExcelProperty(index = 103)
private String column103;
@ExcelProperty(index = 104)
private String column104;
@ExcelProperty(index = 105)
private String column105;
@ExcelProperty(index = 106)
private String column106;
@ExcelProperty(index = 107)
private String column107;
@ExcelProperty(index = 108)
private String column108;
@ExcelProperty(index = 109)
private String column109;
@ExcelProperty(index = 110)
private String column110;
@ExcelProperty(index = 111)
private String column111;
@ExcelProperty(index = 112)
private String column112;
@ExcelProperty(index = 113)
private String column113;
@ExcelProperty(index = 114)
private String column114;
@ExcelProperty(index = 115)
private String column115;
@ExcelProperty(index = 116)
private String column116;
@ExcelProperty(index = 117)
private String column117;
@ExcelProperty(index = 118)
private String column118;
@ExcelProperty(index = 119)
private String column119;
@ExcelProperty(index = 120)
private String column120;
}

@ -0,0 +1,12 @@
package com.dsic.gj_erp.bean.fd;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class FdBean {
private String fdh;
private String color;
private String tplx;
}

@ -0,0 +1,37 @@
package com.dsic.gj_erp.bean.fd;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
@Getter
@Setter
public class TppsQk {
private String czbh;
private String fdh;
private String tpbh;
private String tplx;
private BigDecimal xqsl;
private BigDecimal pssl;
private BigDecimal psbfb;
private String ygpprq;
private String fkpprq;
private String yjtgq;
private String jhxqrq;
private String qfpsrq;
private String qfpsrq1;
private String qfxqrq;
private String sjpsrq;// 实际配送期
private String sjpsrqmin;
private String sjpsrqmax;
private String minjprkrq; // 集配入库日期
private String maxjprkrq;
private String fdxqrq;//分段需求日期
private String zyzzcjmc;//作业车间及场地
private String zyzzssbm;
private BigDecimal pssl0;
private BigDecimal pssl5;
private BigDecimal pssl10;
private BigDecimal pssl15;
}

@ -0,0 +1,47 @@
package com.dsic.gj_erp.bean.sy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
@TableName("SY_DZBMP")
public class SyDzbmp implements Serializable {
private static final long serialVersionUID=1L;
@TableField("YLZD2")
private String ylzd2;
@TableId(value = "BM", type = IdType.ASSIGN_UUID)
private String bm;
@TableField("YLZD5")
private Double ylzd5;
@TableField("BMMS")
private String bmms;
@TableField("BML")
private String bml;
@TableField("YLZD6")
private Double ylzd6;
@TableField("YLZD3")
private String ylzd3;
@TableField("LMS")
private String lms;
@TableField("YLZD4")
private Double ylzd4;
@TableField("YLZD1")
private String ylzd1;
}

@ -0,0 +1,65 @@
package com.dsic.gj_erp.controller.fd;
import com.alibaba.excel.EasyExcel;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.bean.fd.ExcelExport;
import com.dsic.gj_erp.exception.CustomException;
import com.dsic.gj_erp.listeners.ExcelFdListener;
import com.dsic.gj_erp.service.fd.DmCzfddybService;
import io.swagger.annotations.Authorization;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api/dmCzfddyb")
@AllArgsConstructor
public class DmCzfddybController {
private final DmCzfddybService dmCzfddybService;
@PostMapping("/upload")
@Authorization("")
@ResponseBody
public ResultBean upload(@RequestParam("file") MultipartFile file , String czbh, String isupload, HttpServletRequest req) throws Exception, CustomException {
ExcelFdListener objectListener = new ExcelFdListener();
EasyExcel.read(file.getInputStream(), ExcelExport.class, objectListener).sheet(0).headRowNumber(0).doRead();
List<ExcelExport> objList = objectListener.getObjectList();
Map map = dmCzfddybService.uploadFd(req, objList, czbh,isupload);
return new ResultBean(map);
}
@PostMapping("/getCzFdBase")
@Authorization("")
public ResultBean getCzFdBase( HttpServletRequest req,@RequestBody Map<String, Object> map) {
Map rmap = dmCzfddybService.getCzFdBase(req,map);
return new ResultBean(rmap);
}
@PostMapping("/getList")
@Authorization("")
public ResultBean getList( HttpServletRequest req,@RequestBody Map<String, Object> map) throws Exception {
Map rmap = dmCzfddybService.getList(map);
return new ResultBean(rmap);
}
@PostMapping("/getTpBase")
@Authorization("")
public ResultBean getTpBase( HttpServletRequest req,@RequestBody Map<String, Object> map) throws Exception {
Map rmap = dmCzfddybService.getTpBase(req,map);
return new ResultBean(rmap);
}
@PostMapping("/getListFdMx")
@Authorization("")
public ResultBean getListFdMx( HttpServletRequest req,@RequestBody Map<String, Object> map) throws Exception {
Map rmap = dmCzfddybService.getListFdMx(map);
return new ResultBean(rmap);
}
}

@ -0,0 +1,103 @@
package com.dsic.gj_erp.listeners;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.dsic.gj_erp.bean.fd.ExcelExport;
import com.dsic.gj_erp.util.ObjConvertUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ExcelFdListener extends AnalysisEventListener<ExcelExport> {
private static final int BATCH_COUNT = 5;
List<ExcelExport> objectList = new ArrayList<>();
List<Object> headList = new ArrayList<>();
private String sheetName;
List<ExcelExport> datas = new ArrayList<ExcelExport>();
@Override
public void invoke(ExcelExport excelDemo, AnalysisContext analysisContext) {
//每解析一行数据,就会调用该方法一次
//正常在这里调用数据处理得办法
//一条数据添加到暂时存储的存储结构中
boolean b = ObjConvertUtils.checkObjAllFieldsIsNull(excelDemo);
if(!b){
datas.add(excelDemo);
}
// 达到BATCH_COUNT了需要去存储一次数据库防止数据几万条数据在内存容易OOM
if (datas.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
datas.clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
//获取sheetName
saveData();
sheetName = context.readSheetHolder().getSheetName();
// LOGGER.info("所有数据解析完成!");
}
//获取表头
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
//把表头数据加入到存储结构中
headList.add(headMap);
}
/**
*
*/
private void saveData() {
//添加到返回的存储结构中,也可直接存储到数据库
objectList.addAll(datas);
}
public List<ExcelExport> getDatas() {
return datas;
}
public void setDatas(List<ExcelExport> datas) {
this.datas = datas;
}
public List<ExcelExport> getObjectList() {
return objectList;
}
public void setObjectList(List<ExcelExport> objectList) {
this.objectList = objectList;
}
public String getSheetName() {
return sheetName;
}
public void setSheetName(String sheetName) {
this.sheetName = sheetName;
}
public List<Object> getHeadList() {
return headList;
}
public void setHeadList(List<Object> headList) {
this.headList = headList;
}
}

@ -0,0 +1,7 @@
package com.dsic.gj_erp.mapper.fd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsic.gj_erp.bean.fd.DmCzfddyb;
public interface DmCzfddybMapper extends BaseMapper<DmCzfddyb> {
}

@ -0,0 +1,7 @@
package com.dsic.gj_erp.mapper.fd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsic.gj_erp.bean.fd.DmXqdwcjcd;
public interface DmXqdwcjcdMapper extends BaseMapper<DmXqdwcjcd> {
}

@ -0,0 +1,13 @@
package com.dsic.gj_erp.mapper.fd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsic.gj_erp.bean.fd.DmCzfddyb;
import com.dsic.gj_erp.bean.fd.TppsQk;
import java.util.List;
import java.util.Map;
public interface TpbMapper extends BaseMapper<DmCzfddyb> {
List<Map> findTPxqjh(Map map);
List<TppsQk> findTppsQk(Map map);
}

@ -0,0 +1,7 @@
package com.dsic.gj_erp.mapper.sy;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsic.gj_erp.bean.sy.SyDzbmp;
public interface SyDzbmpMapper extends BaseMapper<SyDzbmp> {
}

@ -0,0 +1,259 @@
package com.dsic.gj_erp.service.fd;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.fd.*;
import com.dsic.gj_erp.bean.jcsj.DmCbxxp;
import com.dsic.gj_erp.bean.sy.SyDictItem;
import com.dsic.gj_erp.bean.sy.SyDzbmp;
import com.dsic.gj_erp.mapper.fd.DmCzfddybMapper;
import com.dsic.gj_erp.service.jcsj.DmCbxxpService;
import com.dsic.gj_erp.service.sy.SyDictItemService;
import com.dsic.gj_erp.service.sy.impl.SyDzbmpService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@AllArgsConstructor
public class DmCzfddybService extends ServiceImpl<DmCzfddybMapper,DmCzfddyb> {
private final SyDictItemService syDictItemService;
private final TpImpl tpImpl;
private final DmCbxxpService czjbbService;
private final DmXqdwcjcdService dmXqdwcjcdService;
private final SyDzbmpService syDzbmpService;
@Transactional(rollbackFor = Exception.class)
public Map uploadFd(HttpServletRequest httpRequest, List<ExcelExport> excelList, String czbh, String isupload) throws Exception {
Map rMap = new HashMap();
czbh=czbh+"#";
if ("01".equals(isupload)) {
// 查询是否 有值
List<DmCzfddyb> czbh1 = this.list(new QueryWrapper<DmCzfddyb>().eq("czbh", czbh));
if (czbh1.size() > 0) {
rMap.put("zt", "01");
return rMap;
}
}
this.remove(new QueryWrapper<DmCzfddyb>().eq("CZBH", czbh));
List<DmCzfddyb> addList = new ArrayList<>();
int row = 0;
for (int i = 0; i < excelList.size(); i++) {
ExcelExport e = excelList.get(i);
Class cls = e.getClass();
Field[] fields = cls.getDeclaredFields();
for (int j = 0; j < fields.length; j++) {
String fdh = "";
int col;
Field f = fields[j];
f.setAccessible(true);
try {
fdh = (String) f.get(e);
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
}
if (StringUtils.isNotBlank(fdh)) {
DmCzfddyb czfddyb = new DmCzfddyb();
czfddyb.setCzbh(czbh);
czfddyb.setFdh(fdh);
czfddyb.setFrow(i);
String colName = f.getName();
col = Integer.parseInt(colName.substring(colName.length() - 3));
czfddyb.setFcol(col);
addList.add(czfddyb);
}
//System.out.println("属性名:" + f.getName() + " 属性值:" + );
}
}
this.saveBatch(addList);
return rMap;
}
public Map getCzFdBase(HttpServletRequest req, Map map) {
Map rMap = new HashMap();
String bmbm = (String)req.getAttribute("bmbm");
List<DmCbxxp> czbhs;
if(StringUtils.isNotBlank(bmbm)&& bmbm.length()>2){
czbhs = czjbbService.list(new QueryWrapper<DmCbxxp>()
.select("replace(czbh,'#','') AS czbh")
.in("yzbs", "N", "H").ne("isnull(czjc,'')", "")
.ne("isnull(wgbs,'N')","Y").eq(" isnull(cims_bs,'')","Y").
eq("left(gcqy,1)","0").
orderBy(true, true, "wgbs", "left(czbh,charindex('-',czbh)-1)", "len(czbh)", "czbh"
));
}else{
czbhs = czjbbService.list(new QueryWrapper<DmCbxxp>()
.select("replace(czbh,'#','') AS czbh")
.in("yzbs", "N", "H").ne("isnull(czjc,'')", "").
orderBy(true, true, "wgbs", "left(czbh,charindex('-',czbh)-1)", "len(czbh)", "czbh"
));
}
// 只显示海工名船 简称不等于空
rMap.put("czbhs", czbhs);
return rMap;
}
public Map getList(Map map) throws Exception {
Map returnMap = new HashMap();
List<ExcelExport> returnList = new ArrayList<>();
QueryWrapper<DmCzfddyb> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CZBH", map.get("czbh")+"#");
List<DmCzfddyb> list = this.list(queryWrapper);
queryWrapper.select("max(frow) as frow ", "max(fcol)as fcol");
DmCzfddyb one = (DmCzfddyb) this.getOne(queryWrapper);
if (one != null) {
int row = one.getFrow();
int col = one.getFcol();
for (int i = 0; i <= row; i++) {
ExcelExport excelExport = new ExcelExport();
int tempi = i;
List<DmCzfddyb> collect = list.stream().filter(fst -> fst.getFrow() == tempi).collect(Collectors.toList());
for (int y = 0; y <= col; y++) {
int tempy = y;
DmCzfddyb czfddyb = collect.stream().filter(fst -> fst.getFcol() == tempy).findFirst().orElse(null);
if (null != czfddyb) {
PropertyDescriptor propertyDescriptor = new PropertyDescriptor("column" + String.format("%03d", czfddyb.getFcol()), excelExport.getClass());
Method setMethod = propertyDescriptor.getWriteMethod();
// 调用指定对象set方法
setMethod.invoke(excelExport, czfddyb.getFdh());
// System.out.println(object.getName());// 输出Jack Chen
}
}
returnList.add(excelExport);
}
returnMap.put("data", returnList);
returnMap.put("col", col);
}
return returnMap;
}
public Map getTpBase( HttpServletRequest req,Map map) throws Exception {
Map rMap = new HashMap();
String bmbm = (String)req.getAttribute("bmbm");
List<DmCbxxp> czbhs;
List<DmXqdwcjcd>cdmcs;
List<DmXqdwcjcd>cjmcs;
if(StringUtils.isNotBlank(bmbm)&& bmbm.length()>2){
czbhs = czjbbService.list(new QueryWrapper<DmCbxxp>()
.select("replace(czbh,'#','') AS czbh")
.in("yzbs", "N", "H").ne("isnull(czjc,'')", "")
.ne("isnull(wgbs,'N')","Y").eq(" isnull(cims_bs,'')","Y").
eq("left(gcqy,1)","0").
orderBy(true, true, "wgbs", "left(czbh,charindex('-',czbh)-1)", "len(czbh)", "czbh"
));
cdmcs=dmXqdwcjcdService.list(new QueryWrapper<DmXqdwcjcd>().eq("dwbm","P30000").orderBy(true,true,"cdmc"));
cjmcs=dmXqdwcjcdService.list(new QueryWrapper<DmXqdwcjcd>().select("DISTINCT cjmc as cjmc").eq("dwbm","P30000").orderBy(true,true,"cjmc"));
}else{
czbhs = czjbbService.list(new QueryWrapper<DmCbxxp>()
.select("replace(czbh,'#','') AS czbh")
.in("yzbs", "N", "H").ne("isnull(czjc,'')", "").
orderBy(true, true, "wgbs", "left(czbh,charindex('-',czbh)-1)", "len(czbh)", "czbh"
));
cdmcs=dmXqdwcjcdService.list();
cjmcs=dmXqdwcjcdService.list(new QueryWrapper<DmXqdwcjcd>().select("DISTINCT cjmc as cjmc"));
}
//作业阶段
List<SyDzbmp> zyjds = syDzbmpService.list(new QueryWrapper<SyDzbmp>().eq("bml", "ZYJD"));
//部件类别
List<SyDictItem> bjlbs = syDictItemService.list(new QueryWrapper<SyDictItem>().eq("bmlb", "TPLX"));
// List<Map> xqdws = mpZzdwjbbMapper.findxqdwAll();
List<SyDictItem> bmbms = syDictItemService.list(new QueryWrapper<SyDictItem>().eq("bmlb", "bmbm").in("bm","01","02","03","04"));
rMap.put("czbhs", czbhs);
rMap.put("zyjds", zyjds);
rMap.put("bjlbs", bjlbs);
// rMap.put("xqdws", xqdws);
rMap.put("bmbms", bmbms);
rMap.put("cdmcs", cdmcs);
rMap.put("cjmcs", cjmcs);
return rMap;
}
public Map getListFdMx(Map map) throws Exception {
// Map returnMap = new HashMap();
Map returnMap = this.getList(map);
List<TppsQk> tppsQks = tpImpl.findTppsQk(map);
Map<String, List<TppsQk>> collect = tppsQks.stream().collect(
Collectors.groupingBy(
score -> score.getFdh()+'-'+score.getTplx()
));
List<FdBean> fdBeans=new ArrayList<>();
for(Map.Entry<String, List<TppsQk>> entry : collect.entrySet()){
FdBean fdBean=new FdBean();
String mapKey = entry.getKey();
String color="";
String[] parts = mapKey.split("-");
String fdh=parts[0];
String tplx=parts[1];
// if(a.compareTo(b) < 1){
// System.out.println("a小于等于b");
// }
BigDecimal xqslSum=entry.getValue().stream().map(s-> s.getXqsl()).reduce(BigDecimal.ZERO,BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal psslSum=entry.getValue().stream().map(s-> s.getPssl()).reduce(BigDecimal.ZERO,BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
List<TppsQk> rqList=entry.getValue();
boolean flag=false;
// if(fdh.equals("ZL04")){
// rqList.get(0).setQfxqrq("2022/04/13");
// }
for(TppsQk q :rqList){
if(StringUtils.isNotBlank(q.getQfxqrq())){
flag=true;
}
}
if(xqslSum.compareTo(BigDecimal.ZERO)==0 ){
}else{
BigDecimal result =psslSum.divide(xqslSum,2,BigDecimal.ROUND_HALF_UP);
System.out.println("result = " + result +"xqsl"+xqslSum +"pssl"+psslSum+"fhd"+fdh);
if(result.compareTo(new BigDecimal("0.9"))> -1 ){ // result > =0.9
if("0201".equals(tplx)){
color="green";
}
}else if (result.compareTo(new BigDecimal("0.5"))>-1 && result.compareTo(new BigDecimal("0.9"))<1 ) {
if("0201".equals(tplx)){
color="yellow";
}
}else if( result.compareTo(new BigDecimal("0.5"))<1 && flag ){
if("0201".equals(tplx)){
color="red";
}
}
System.out.println("result = " + result +"xqsl"+xqslSum +"pssl"+psslSum+"fhd"+fdh+"COLOR"+color);
}
fdBean.setFdh(fdh);
fdBean.setTplx(tplx);
fdBean.setColor(color);
fdBeans.add(fdBean);
}
returnMap.put("fd", fdBeans);
returnMap.put("fdqk", tppsQks);
return returnMap;
}
}

@ -0,0 +1,10 @@
package com.dsic.gj_erp.service.fd;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.fd.DmXqdwcjcd;
import com.dsic.gj_erp.mapper.fd.DmXqdwcjcdMapper;
import org.springframework.stereotype.Service;
@Service
public class DmXqdwcjcdService extends ServiceImpl<DmXqdwcjcdMapper, DmXqdwcjcd> {
}

@ -0,0 +1,104 @@
package com.dsic.gj_erp.service.fd;
import cn.hutool.core.date.DateUtil;
import com.dsic.gj_erp.bean.fd.TppsQk;
import com.dsic.gj_erp.mapper.fd.TpbMapper;
import com.dsic.gj_erp.util.MyString;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
@AllArgsConstructor
public class TpImpl {
private final TpbMapper tpbMapper;
public List<Map> findTPxqjh(Map map) {
List<Map> tPxqjhs = tpbMapper.findTPxqjh(map);
//需求反馈预估天数差xqtsc
// 有反馈用反馈 没有用预估
for(Map map1:tPxqjhs){
String one = "";
String two = "";
String fkpprq =(String)map1.get("fkpprq"); //反馈配送期
String ygpprq =(String)map1.get("ygpprq"); //预计配送期
if(StringUtils.isNotBlank(fkpprq)){
one=fkpprq;
}else if(StringUtils.isNotBlank(ygpprq)){
one=ygpprq;
String qfxqrq =(String)map1.get("qfxqrq"); // 前方实际需求
String jhxqrq =(String)map1.get("jhxqrq"); //集团三月滚动计划期
String fdxqrq =(String)map1.get("fdxqrq"); //分段计划需求期
if(StringUtils.isNotBlank(qfxqrq)){
two=qfxqrq;
}else if (StringUtils.isNotBlank(fdxqrq)){
two=fdxqrq;
}else{
two=jhxqrq;
}
// 日期相检查
Date oneDate = DateUtil.parse(one);
Date twoDate = DateUtil.parse(two);
// long betweenDay = DateUtil.between(twoDate, oneDate, DateUnit.DAY);
long betweenDay= MyString.differentDays(oneDate,twoDate);
map1.put("xqtsc",betweenDay);
}else{
map1.put("xqtsc","");
}
}
return tPxqjhs;
}
public List<TppsQk> findTppsQk(Map map) {
List<TppsQk> tppsQks = tpbMapper.findTppsQk(map);
for (TppsQk t : tppsQks) {
// if(t.getPssl().compareTo(new BigDecimal("100"))==0){
// if(StringUtils.isNotBlank(t.getps))
//
// }else
//最小值 不为空 不用显示了
if (StringUtils.isNotBlank(t.getQfpsrq())) {
// t.setYjtgq(t.getQfpsrq1());
//最小的不爲空 用最大的 jprkrq
} else if (StringUtils.isNotBlank(t.getMinjprkrq())){
Date date = DateUtil.parse(t.getMaxjprkrq());
t.setYgpprq(DateUtil.format( DateUtil.offsetDay(date, 2), "yyyy/MM/dd"));
//System.out.println("date = " + t.getMaxjprkrq()+"111"+t.getYgpprq());
} else if (StringUtils.isNotBlank(t.getFkpprq())) { //反馈配送
t.setYjtgq(t.getFkpprq());
} else if (StringUtils.isNotBlank(t.getYgpprq())) {
t.setYjtgq(t.getYgpprq());
} else {
t.setYjtgq("");
}
if ("9999/99/99".equals(t.getSjpsrqmax())) {
t.setSjpsrqmax("");
}
if(t.getXqsl().compareTo(t.getPssl())==0){
}else{
t.setPssl0(((t.getPssl().add(t.getPssl0())).divide(t.getXqsl(), BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100.0"))).setScale(2, BigDecimal.ROUND_HALF_UP) );
t.setPssl5(((t.getPssl().add(t.getPssl5())).divide(t.getXqsl(),BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100.0"))).setScale(2, BigDecimal.ROUND_HALF_UP) );
t.setPssl10(((t.getPssl().add(t.getPssl10())).divide(t.getXqsl(),BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100.0"))).setScale(2, BigDecimal.ROUND_HALF_UP) );
t.setPssl15(((t.getPssl().add(t.getPssl15())).divide(t.getXqsl(),BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100.0"))).setScale(2, BigDecimal.ROUND_HALF_UP) );
}
}
return tppsQks;
}
}

@ -0,0 +1,10 @@
package com.dsic.gj_erp.service.sy.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.sy.SyDzbmp;
import com.dsic.gj_erp.mapper.sy.SyDzbmpMapper;
import org.springframework.stereotype.Service;
@Service
public class SyDzbmpService extends ServiceImpl<SyDzbmpMapper, SyDzbmp> {
}

@ -0,0 +1,146 @@
package com.dsic.gj_erp.util;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.Calendar;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MyString {
/**
* 线
*/
public static String lineToHump(String str) {
Pattern linePattern = Pattern.compile("_(\\w)");
str = str.toLowerCase();
Matcher matcher = linePattern.matcher(str);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
}
matcher.appendTail(sb);
return sb.toString();
}
/**
* findtest
* @param srcText
* @param findText
* @return
*/
public static int appearNumber(String srcText, String findText) {
int count = 0;
int index = 0;
while ((index = srcText.indexOf(findText, index)) != -1) {
index = index + findText.length();
count++;
}
return count;
}
//使用commons的jexl可实现将字符串变成可执行代码的功能
public static String replace1(String gs){
String replace1=gs;
if(gs.contains("[")){
replace1 = gs.replace("[", "s.get");
}
if(gs.contains("]d")){
replace1 = replace1.replace("]d", "().doubleValue()");
}
if(gs.contains("]")){
replace1 = replace1.replace("]", "()");
}
if (NumberUtils.isNumber(gs)){
return gs;
}
if (gs.equals("null")){
return "";
}
return replace1;
}
public static String subZeroAndDot(String s){
if(StringUtils.isBlank(s)){
return null;
}
if(s.indexOf(".") > 0){
s = s.replaceAll("0+?$", "");//去掉多余的0
s = s.replaceAll("[.]$", "");//如最后一位是.则去掉
}
return s;
}
/**
(DBC case)<br/><br/>
1228832
(33-126)(65281-65374)65248
* @param input
* @return
*
*/
public static String ToDBC(String input) {
char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == 12288) {
//全角空格为12288半角空格为32
c[i] = (char) 32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
//其他字符半角(33-126)与全角(65281-65374)的对应关系是均相差65248
c[i] = (char) (c[i] - 65248);
}
return new String(c);
}
/**
*
* date2date1
* @param date1
* @param date2
* @return
*/
public static int differentDays(Date date1, Date date2)
{
Calendar cal1 = Calendar.getInstance();
cal1.setTime(date1);
Calendar cal2 = Calendar.getInstance();
cal2.setTime(date2);
int day1= cal1.get(Calendar.DAY_OF_YEAR);
int day2 = cal2.get(Calendar.DAY_OF_YEAR);
int year1 = cal1.get(Calendar.YEAR);
int year2 = cal2.get(Calendar.YEAR);
if(year1 != year2) //同一年
{
int timeDistance = 0 ;
for(int i = year1 ; i < year2 ; i ++)
{
if(i%4==0 && i%100!=0 || i%400==0) //闰年
{
timeDistance += 366;
}
else //不是闰年
{
timeDistance += 365;
}
}
return timeDistance + (day2-day1) ;
}
else //不同年
{
System.out.println("判断day2 - day1 : " + (day2-day1));
return day2-day1;
}
}
}

@ -0,0 +1,525 @@
<?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.dsic.gj_erp.mapper.fd.TpbMapper">
<select id="findTPxqjh" parameterType="map" resultType="map" >
SELECT mp_tpxqjhb.jhid,
mp_tpxqjhb.jhqh,
mp_tpxqjhb.czbh,
mp_tpxqjhb.wp_no,
mp_tpxqjhb.wo_no,
mp_tpxqjhb.zyzzssbm,
mp_tpxqjhb.zyzzssbmmc,
mp_tpxqjhb.zyzzcjbm,
mp_tpxqjhb.zyzzcjmc,
mp_tpxqjhb.zyzzzzbm,
mp_tpxqjhb.zyzzzzmc,
mp_tpxqjhb.tpbh,
mp_tpxqjhb.hh,
mp_tpxqjhb.azth,
mp_tpxqjhb.bjdh,
mp_tpxqjhb.wpdesc,
mp_tpxqjhb.bjmc,
mp_tpxqjhb.wpgg,
mp_tpxqjhb.wpth,
mp_tpxqjhb.wpxh,
mp_tpxqjhb.ctjwph,
mp_tpxqjhb.ctjwpmc,
mp_tpxqjhb.jldw,
mp_tpxqjhb.hsdw,
mp_tpxqjhb.bjzl,
mp_tpxqjhb.xqsl,
mp_tpxqjhb.bjzzl,
mp_tpxqjhb.bmjhksrq,
mp_tpxqjhb.bmjhjsrq,
mp_tpxqjhb.iss_req_no,
mp_tpxqjhb.sqrq,
mp_tpxqjhb.nq,
mp_tpxqjhb.xqrq,
mp_tpxqjhb.psrq,
mp_tpxqjhb.jsrq,
mp_tpxqjhb.jzzt,
mp_tpxqjhb.por_no,
mp_tpxqjhb.jhxqrq,
mp_tpxqjhb.lc,
mp_tpxqjhb.bz,
mp_tpxqjhb.zztpbh,
mp_tpxqjhb.zzth,
mp_tpxqjhb.tpbqf,
mp_tpxqjhb.tpbzy,
mp_tpxqjhb.zztmc,
mp_tpxqjhb.sscj,
mp_tpxqjhb.jhzt,
mp_tpxqjhb.jhlx,
mp_tpxqjhb.jhfs,
mp_tpxqjhb.fdh,
mp_tpxqjhb.zyjd,
mp_tpxqjhb.tplx,
mp_tpxqjhb.cplx,
mp_tpxqjhb.tjlx,
mp_tpxqjhb.zdcp,
mp_tpxqjhb.xzgsnr,
mp_tpxqjhb.tjbs,
mp_tpxqjhb.scfs,
mp_tpxqjhb.mzsczq,
mp_tpxqjhb.mzsccl,
mp_tpxqjhb.mzscnl,
mp_tpxqjhb.mzscqt,
mp_tpxqjhb.xzjhrkrq,
mp_tpxqjhb.xzjhzzrq,
mp_tpxqjhb.zzzt,
mp_tpxqjhb.jhjtrq,
mp_tpxqjhb.sjltrq,
mp_tpxqjhb.jswgrq,
mp_tpxqjhb.fkwtlx,
mp_tpxqjhb.fkwtsm,
mp_tpxqjhb.fkpprq,
mp_tpxqjhb.jhqh_sq,
mp_tpxqjhb.jhxqrq_sq,
mp_tpxqjhb.jhxqrq_ls,
mp_tpxqjhb.jhdrry,
mp_tpxqjhb.jhdrrq,
mp_tpxqjhb.jhxfry,
mp_tpxqjhb.jhxfrq,
mp_tpxqjhb.jhfkry,
mp_tpxqjhb.jhfkrq,
mp_tpxqjhb.jhqrry,
mp_tpxqjhb.jhqrrq,
mp_tpxqjhb.jhpsry,
mp_tpxqjhb.jhpsrq,
mp_tpxqjhb.ylzd1,
mp_tpxqjhb.ylzd2,
mp_tpxqjhb.ylzd3,
mp_tpxqjhb.ylzd4,
mp_tpxqjhb.ylzd5,
mp_tpxqjhb.ylzd6,
mp_tpxqjhb.fdxqrq,
'N' as bs,
'N' as bs_all,
(case when isnull(vw_mp_tpxqjhb_jsscps.jprkrq,'')&lt;&gt;'' then vw_mp_tpxqjhb_jsscps.jprkrq
when isnull(mp_tpxqjhb.scfs,'')='CG' then isnull(vw_mp_tpxqjhb_jsscps.tzwgjhrq,'')
when mp_tpxqjhb.tplx='0201' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0202' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,25,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0301' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,17,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0302' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,35,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0101' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,60,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0102' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,9,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,30,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
else '' end) as ygpprq,
(case when len(isnull(mp_tpxqjhb.jhxqrq_sq,''))>0 and len(isnull(mp_tpxqjhb.jhxqrq,''))>0 then datediff(dd,mp_tpxqjhb.jhxqrq_sq,mp_tpxqjhb.jhxqrq) else 0 end) as jhbgts,
(case when len(isnull(mp_tpxqjhb.jhjtrq,''))>0 and len(isnull(mp_tpxqjhb.fdxqrq,''))>0 then datediff(dd,mp_tpxqjhb.jhjtrq,mp_tpxqjhb.fdxqrq)
when len(isnull(mp_tpxqjhb.jhjtrq,''))>0 and len(isnull(mp_tpxqjhb.jhxqrq,''))>0 then datediff(dd,mp_tpxqjhb.jhjtrq,mp_tpxqjhb.jhxqrq)
else 0 end) as jtxqts,
vw_mp_tpxqjhb_jsscps.zztph,
vw_mp_tpxqjhb_jsscps.sjltsj,
vw_mp_tpxqjhb_jsscps.ltxqts,
vw_mp_tpxqjhb_jsscps.zzt_bjsl,
vw_mp_tpxqjhb_jsscps.zzt_bjzl,
vw_mp_tpxqjhb_jsscps.zzt_bjzzl,
vw_mp_tpxqjhb_jsscps.zzt_zt,
vw_mp_tpxqjhb_jsscps.zzt_gyjssj,
vw_mp_tpxqjhb_jsscps.zzt_gyclry,
vw_mp_tpxqjhb_jsscps.zzt_gyspsj,
vw_mp_tpxqjhb_jsscps.zzt_gyspry,
vw_mp_tpxqjhb_jsscps.zzt_cplx,
vw_mp_tpxqjhb_jsscps.zzt_clfs,
vw_mp_tpxqjhb_jsscps.zzt_bmcl,
vw_mp_tpxqjhb_jsscps.zzt_ntzdm,
vw_mp_tpxqjhb_jsscps.zzt_wtzdm,
vw_mp_tpxqjhb_jsscps.sgdw,
vw_mp_tpxqjhb_jsscps.tzdw1,
vw_mp_tpxqjhb_jsscps.tzdw,
vw_mp_tpxqjhb_jsscps.psdw,
vw_mp_tpxqjhb_jsscps.xglx,
vw_mp_tpxqjhb_jsscps.xgph,
vw_mp_tpxqjhb_jsscps.xgsj,
vw_mp_tpxqjhb_jsscps.xgtzdh,
vw_mp_tpxqjhb_jsscps.sc_zt,
vw_mp_tpxqjhb_jsscps.jgwgjhrq,
vw_mp_tpxqjhb_jsscps.scjhsprq,
vw_mp_tpxqjhb_jsscps.jgwgrq,
vw_mp_tpxqjhb_jsscps.tzwgjhrq,
vw_mp_tpxqjhb_jsscps.tzjsrq,
vw_mp_tpxqjhb_jsscps.tzwgrq,
vw_mp_tpxqjhb_jsscps.jprkrq,
vw_mp_tpxqjhb_jsscps.scqkbz,
vw_mp_tpxqjhb_jsscps.ps_zt,
vw_mp_tpxqjhb_jsscps.qfsqrq,
vw_mp_tpxqjhb_jsscps.qfxqrq,
vw_mp_tpxqjhb_jsscps.qfxqsl,
vw_mp_tpxqjhb_jsscps.qfpsdh,
vw_mp_tpxqjhb_jsscps.qfpssl,
vw_mp_tpxqjhb_jsscps.qfpswc,
vw_mp_tpxqjhb_jsscps.qfpsrq,
vw_mp_tpxqjhb_jsscps.qfqrry,
vw_mp_tpxqjhb_jsscps.qfqrrq,
vw_mp_tpxqjhb_jsscps.psqkbz
FROM mp_tpxqjhb left join vw_mp_tpxqjhb_jsscps on (mp_tpxqjhb.jhid = vw_mp_tpxqjhb_jsscps.jhid and vw_mp_tpxqjhb_jsscps.sscj='02'
and vw_mp_tpxqjhb_jsscps.TPLX IN ('0201')
<if test=" czbh!=null and czbh!=''">
and vw_mp_tpxqjhb_jsscps.czbh =#{czbh}+'#'
</if>
<if test=" czbh1!=null and czbh1!=''">
and vw_mp_tpxqjhb_jsscps.czbh =#{czbh1}
</if>
)
WHERE mp_tpxqjhb.jhzt>'01' and not ( mp_tpxqjhb.zyzzssbm='P30000' AND mp_tpxqjhb.zyjd='6')
<if test="rqopt=='01'.toString() ">
<if test=" jhrq!=null and jhrq!=''">
and mp_tpxqjhb.jhxqrq >=#{jhrq}
</if>
<if test=" jhrq1!=null and jhrq1!=''">
and mp_tpxqjhb.jhxqrq &lt;=#{jhrq1}
</if>
</if>
<if test="rqopt=='02'.toString() ">
<if test=" jhrq!=null and jhrq!=''">
and mp_tpxqjhb.fdxqrq >=#{jhrq}
</if>
<if test=" jhrq1!=null and jhrq1!=''">
and mp_tpxqjhb.fdxqrq &lt;=#{jhrq1}
</if>
</if>
<if test=" xqdw!=null and xqdw!=''">
and mp_tpxqjhb.zyzzssbm =#{xqdw}
</if>
<if test=" czbh!=null and czbh!=''">
and mp_tpxqjhb.czbh =#{czbh}+'#'
</if>
<if test=" czbh1!=null and czbh1!=''">
and mp_tpxqjhb.czbh =#{czbh1}
</if>
<if test=" zyjd!=null and zyjd!=''">
and mp_tpxqjhb.zyjd =#{zyjd}
</if>
<if test=" fdh!=null and fdh!=''">
and mp_tpxqjhb.fdh =#{fdh}
</if>
<if test=" bjlb!=null and bjlb!=''">
and mp_tpxqjhb.tplx =#{bjlb}
</if>
<if test=" tpbh!=null and tpbh!=''">
and mp_tpxqjhb.tpbh like '%'+#{tpbh}+'%'
</if>
<if test=" tpbh1!=null and tpbh1!=''">
and mp_tpxqjhb.tpbh =#{tpbh1}
</if>
<if test=" azth!=null and azth!=''">
and mp_tpxqjhb.azth like '%'+#{azth}+'%'
</if>
<if test=" zzth!=null and zzth!=''">
and mp_tpxqjhb.zzth like '%'+#{zzth}+'%'
</if>
<if test=" bjms!=null and bjms!=''">
and (mp_tpxqjhb.bjdh like '%'+#{bjms}+'%' or mp_tpxqjhb.wpdesc like '%'+#{bjms}+'%' )
</if>
<if test=" bmbm!=null and bmbm!=''">
and mp_tpxqjhb.sscj =#{bmbm}
</if>
order by mp_tpxqjhb.czbh,mp_tpxqjhb.tpbh,mp_tpxqjhb.hh,mp_tpxqjhb.bjdh
</select>
<select id="findTppsQk" resultType="com.dsic.xzerp.bean.fd.TppsQk" parameterType="map">
SELECT
mp_tpxqjhb.czbh,
mp_tpxqjhb.fdh,
mp_tpxqjhb.tpbh,
mp_tpxqjhb.tplx,
sum( isnull(mp_tpxqjhb.xqsl,0)) as xqsl,
sum( case when isnull( vw_mp_tpxqjhb_jsscps.qfpsrq,'')&lt;&gt;'' then isnull(mp_tpxqjhb.xqsl,0) else 0 end ) pssl,
sum(case when isnull(vw_mp_tpxqjhb_jsscps.qfpsrq,'')='' and
datediff(dd,isnull(nullif(isnull(nullif(MP_TPXQJHB.fkpprq,''),(case when isnull(vw_mp_tpxqjhb_jsscps.jprkrq,'')&lt;&gt;'' then vw_mp_tpxqjhb_jsscps.jprkrq
when isnull(mp_tpxqjhb.scfs,'')='CG' then isnull(vw_mp_tpxqjhb_jsscps.tzwgjhrq,'')
when mp_tpxqjhb.tplx='0201' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0202' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,25,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0301' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,17,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0302' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,35,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0101' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,60,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0102' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,9,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,30,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
else '' end)),''),'9999/12/31')
,isnull(nullif(vw_mp_tpxqjhb_jsscps.qfxqrq,''),isnull(nullif(mp_tpxqjhb.fdxqrq,''),isnull(nullif(mp_tpxqjhb.jhxqrq,''),''))) )>=0
then isnull(mp_tpxqjhb.xqsl,0)
else 0 end) as pssl0,
sum(case when isnull(vw_mp_tpxqjhb_jsscps.qfpsrq,'')='' and
datediff(dd,isnull(nullif(isnull(nullif(MP_TPXQJHB.fkpprq,''),(case when isnull(vw_mp_tpxqjhb_jsscps.jprkrq,'')&lt;&gt;'' then vw_mp_tpxqjhb_jsscps.jprkrq
when isnull(mp_tpxqjhb.scfs,'')='CG' then isnull(vw_mp_tpxqjhb_jsscps.tzwgjhrq,'')
when mp_tpxqjhb.tplx='0201' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0202' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,25,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0301' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,17,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0302' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,35,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0101' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,60,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0102' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,9,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,30,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
else '' end)),''),'9999/12/31')
,isnull(nullif(vw_mp_tpxqjhb_jsscps.qfxqrq,''),isnull(nullif(mp_tpxqjhb.fdxqrq,''),isnull(nullif(mp_tpxqjhb.jhxqrq,''),''))) )>=-5
then isnull(mp_tpxqjhb.xqsl,0)
else 0 end) as pssl5,
sum(case when isnull(vw_mp_tpxqjhb_jsscps.qfpsrq,'')='' and
datediff(dd,isnull(nullif(isnull(nullif(MP_TPXQJHB.fkpprq,''),(case when isnull(vw_mp_tpxqjhb_jsscps.jprkrq,'')&lt;&gt;'' then vw_mp_tpxqjhb_jsscps.jprkrq
when isnull(mp_tpxqjhb.scfs,'')='CG' then isnull(vw_mp_tpxqjhb_jsscps.tzwgjhrq,'')
when mp_tpxqjhb.tplx='0201' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0202' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,25,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0301' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,17,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0302' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,35,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0101' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,60,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0102' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,9,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,30,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
else '' end)),''),'9999/12/31')
,isnull(nullif(vw_mp_tpxqjhb_jsscps.qfxqrq,''),isnull(nullif(mp_tpxqjhb.fdxqrq,''),isnull(nullif(mp_tpxqjhb.jhxqrq,''),''))) )>=-10
then isnull(mp_tpxqjhb.xqsl,0)
else 0 end) as pssl10,
sum(case when isnull(vw_mp_tpxqjhb_jsscps.qfpsrq,'')='' and
datediff(dd,isnull(nullif(isnull(nullif(MP_TPXQJHB.fkpprq,''),(case when isnull(vw_mp_tpxqjhb_jsscps.jprkrq,'')&lt;&gt;'' then vw_mp_tpxqjhb_jsscps.jprkrq
when isnull(mp_tpxqjhb.scfs,'')='CG' then isnull(vw_mp_tpxqjhb_jsscps.tzwgjhrq,'')
when mp_tpxqjhb.tplx='0201' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0202' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,25,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0301' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,17,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0302' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,35,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0101' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,60,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0102' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,9,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,30,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
else '' end)),''),'9999/12/31')
,isnull(nullif(vw_mp_tpxqjhb_jsscps.qfxqrq,''),isnull(nullif(mp_tpxqjhb.fdxqrq,''),isnull(nullif(mp_tpxqjhb.jhxqrq,''),''))) )>=-15
then isnull(mp_tpxqjhb.xqsl,0)
else 0 end) as pssl15,
round( (sum( case when isnull( vw_mp_tpxqjhb_jsscps.qfpsrq,'')&lt;&gt;''then isnull(mp_tpxqjhb.xqsl,0) else 0 end )*1.0
/ sum( isnull(mp_tpxqjhb.xqsl,0))*1.0 )*100.0,2) as psbfb,
max((case when isnull(vw_mp_tpxqjhb_jsscps.jprkrq,'')&lt;&gt;'' then vw_mp_tpxqjhb_jsscps.jprkrq
when isnull(mp_tpxqjhb.scfs,'')='CG' then isnull(vw_mp_tpxqjhb_jsscps.tzwgjhrq,'')
when mp_tpxqjhb.tplx='0201' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0202' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,25,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0301' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,17,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,90,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0302' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,12,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,35,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0101' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,5,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,20,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,60,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
when mp_tpxqjhb.tplx='0102' then
(case when isnull(vw_mp_tpxqjhb_jsscps.tzwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,2,vw_mp_tpxqjhb_jsscps.tzwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.jgwgrq,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,9,vw_mp_tpxqjhb_jsscps.jgwgrq),111)
when isnull(vw_mp_tpxqjhb_jsscps.sjltsj,'')&lt;&gt;'' then convert(varchar(10),dateadd(dd,30,vw_mp_tpxqjhb_jsscps.sjltsj),111)
else '' end)
else '' end) )as ygpprq,
max(mp_tpxqjhb.fkpprq) as fkpprq,
min( mp_tpxqjhb.jhxqrq) as jhxqrq,
min( isnull(vw_mp_tpxqjhb_jsscps.qfpsrq,'')) as qfpsrq,
max( isnull(vw_mp_tpxqjhb_jsscps.qfpsrq,'')) as qfpsrq1,
min(case when isnull(nullif(vw_mp_tpxqjhb_jsscps.qfpsrq,''),'')='' then null else vw_mp_tpxqjhb_jsscps.qfpsrq end) as sjpsrqmin,
max(case when isnull(nullif(vw_mp_tpxqjhb_jsscps.qfpsrq,''),'')='' then '9999/99/99' else vw_mp_tpxqjhb_jsscps.qfpsrq end) as sjpsrqmax,
max( isnull(vw_mp_tpxqjhb_jsscps.qfpsrq,'')) as sjpsrq,
min( vw_mp_tpxqjhb_jsscps.qfxqrq) as qfxqrq,
min( vw_mp_tpxqjhb_jsscps.jprkrq) as minjprkrq,
max( vw_mp_tpxqjhb_jsscps.jprkrq) as maxjprkrq,
min(mp_tpxqjhb.fdxqrq) as fdxqrq,
max(mp_tpxqjhb.zyzzcjmc) as zyzzcjmc,
max(mp_tpxqjhb.zyzzssbm) as zyzzssbm
FROM mp_tpxqjhb left join vw_mp_tpxqjhb_jsscps on (mp_tpxqjhb.jhid = vw_mp_tpxqjhb_jsscps.jhid and vw_mp_tpxqjhb_jsscps.sscj='02'
and vw_mp_tpxqjhb_jsscps.TPLX IN ('0201')
)
WHERE mp_tpxqjhb.jhzt>'01'
and not ( mp_tpxqjhb.zyzzssbm='P30000' AND mp_tpxqjhb.zyjd='6')
<if test=" czbh!=null and czbh!=''">
and mp_tpxqjhb.czbh =#{czbh}+'#'
</if>
<if test=" fdh!=null and fdh!=''">
and mp_tpxqjhb.fdh =#{fdh}
</if>
<if test=" tpbh!=null and tpbh!=''">
and mp_tpxqjhb.tpbh =#{tpbh}
</if>
<if test=" xqdw!=null and xqdw!=''">
and mp_tpxqjhb.zyzzssbm =#{xqdw}
</if>
<if test=" zyzzcjmc!=null and zyzzcjmc!=''">
and mp_tpxqjhb.zyzzcjmc like '%'+#{zyzzcjmc}+'%'
</if>
<if test=" cjmc!=null and cjmc!=''">
and mp_tpxqjhb.zyzzcjmc in (select cdmc from dm_xqdwcjcd where dwbm=#{xqdw} and cjmc=#{cjmc} )
</if>
<if test=" cdmc!=null and cdmc!=''">
and mp_tpxqjhb.zyzzcjmc like #{cdmc}+'%'
</if>
GROUP BY mp_tpxqjhb.czbh,
mp_tpxqjhb.fdh,
mp_tpxqjhb.tpbh,
mp_tpxqjhb.tplx
order by mp_tpxqjhb.czbh,
mp_tpxqjhb.fdh,
mp_tpxqjhb.tpbh
</select>
</mapper>
Loading…
Cancel
Save