Commit b1b16318 by liuyang

2024-04-26 销售目标和销售计划功能优化

parent aea392ae
......@@ -32,12 +32,13 @@ public class HPPZ018 extends DaoEPBase {
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0:否1.是*/
public static final String FIELD_PARENT_ID = "parentId"; /* 父级ID*/
public static final String FIELD_YEAR = "year"; /* 年度*/
public static final String FIELD_MONTH = "month"; /* 月份*/
public static final String FIELD_SALES_CODE = "salesCode"; /* 销售单号*/
public static final String FIELD_PLAN_SALES_CODE = "planSalesCode"; /* 销售计划单号*/
public static final String FIELD_SALES_AMOUNT = "salesAmount"; /* 营销额*/
public static final String FIELD_STATUS = "status"; /* 状态 0-未审核,1-已审核*/
public static final String FIELD_STATUS = "status"; /* 审批状态 0-未审批 1-已审批*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码*/
......@@ -49,12 +50,13 @@ public class HPPZ018 extends DaoEPBase {
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0:否1.是*/
public static final String COL_PARENT_ID = "PARENT_ID"; /* 父级ID*/
public static final String COL_YEAR = "YEAR"; /* 年度*/
public static final String COL_MONTH = "MONTH"; /* 月份*/
public static final String COL_SALES_CODE = "SALES_CODE"; /* 销售单号*/
public static final String COL_PLAN_SALES_CODE = "PLAN_SALES_CODE"; /* 销售计划单号*/
public static final String COL_SALES_AMOUNT = "SALES_AMOUNT"; /* 营销额*/
public static final String COL_STATUS = "STATUS"; /* 状态 0-未审核,1-已审核*/
public static final String COL_STATUS = "STATUS"; /* 审批状态 0-未审批 1-已审批*/
public static final String QUERY = "HPPZ018.query";
public static final String COUNT = "HPPZ018.count";
......@@ -63,6 +65,7 @@ public class HPPZ018 extends DaoEPBase {
public static final String DELETE = "HPPZ018.delete";
public static final String DELETE_FLAG = "HPPZ018.deleteFlag";
public static final String UPDATE_STATUS = "HPPZ018.updateStatus";
public static final String DELETE_BY_PARENT_ID = "HPPZ018.deleteByParentId";
private Long id = new Long(0); /* ID*/
private String companyCode = " "; /* 企业编码*/
......@@ -74,12 +77,13 @@ public class HPPZ018 extends DaoEPBase {
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 修改时间*/
private Integer deleteFlag = 0; /* 是否删除0:否1.是*/
private Long parentId = new Long(0); /* 父级ID*/
private String year = " "; /* 年度*/
private String month = " "; /* 月份*/
private String salesCode = " "; /* 销售单号*/
private String planSalesCode = " "; /* 销售计划单号*/
private BigDecimal salesAmount = new BigDecimal("0"); /* 营销额*/
private Integer status = 0; /* 状态 0-未审核,1-已审核*/
private Integer status = 0; /* 审批状态 0-未审批 1-已审批*/
/**
......@@ -129,6 +133,10 @@ public class HPPZ018 extends DaoEPBase {
eiColumn.setDescName("是否删除0:否1.是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PARENT_ID);
eiColumn.setDescName("父级ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_YEAR);
eiColumn.setDescName("年度");
eiMetadata.addMeta(eiColumn);
......@@ -325,6 +333,15 @@ public class HPPZ018 extends DaoEPBase {
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
/**
* get the year - 年度.
* @return the year
......@@ -432,6 +449,7 @@ public class HPPZ018 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setParentId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setYear(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_YEAR)), year));
setMonth(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MONTH)), month));
setSalesCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SALES_CODE)), salesCode));
......@@ -457,6 +475,7 @@ public class HPPZ018 extends DaoEPBase {
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID)));
map.put(FIELD_YEAR, StringUtils.toString(year, eiMetadata.getMeta(FIELD_YEAR)));
map.put(FIELD_MONTH, StringUtils.toString(month, eiMetadata.getMeta(FIELD_MONTH)));
map.put(FIELD_SALES_CODE, StringUtils.toString(salesCode, eiMetadata.getMeta(FIELD_SALES_CODE)));
......
......@@ -56,6 +56,14 @@ public class ServiceHPPZ017 extends ServiceEPBase {
Map<?, ?> map = eiBlock.getRow(i);
hppz017.fromMap(map);
hppz017.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hppz017.getStatus() == 1) {
//判断销售目标的销售计划是否有审批通过
HPPZTools.HpPz018.getPanentId(hppz017.getId(),1);
DaoUtils.update(HPPZ018.DELETE_BY_PARENT_ID,new HashMap<String,Object>(){{
put(HPPZ018.FIELD_PARENT_ID,hppz017.getId());
put(HPPZ018.FIELD_DELETE_FLAG,CommonConstant.YesNo.YES_1);
}});
}
DaoUtils.update(HPPZ017.DELETE_FLAG, hppz017);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......@@ -63,9 +71,10 @@ public class ServiceHPPZ017 extends ServiceEPBase {
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
//inInfo.setStatus(EiConstant.STATUS_FAILURE);
LogUtils.setDetailMsg(inInfo, e, "删除失败");
//ErrorCodeUtils.handleDeleteException(inInfo,i,e);
//logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
......@@ -129,6 +138,7 @@ public class ServiceHPPZ017 extends ServiceEPBase {
HPPZ018 hppz018 = new HPPZ018();
hppz018.toMap();
hppz018.setYear(hppz017.getYear());
hppz018.setParentId(Long.valueOf(id));
hppz018.setSalesCode(hppz017.getSalesCode());
BigDecimal bigDecimal = hppz017.getSalesAmount().divide(new BigDecimal(12),2,RoundingMode.UP);
for (String months:MONTHS) {
......@@ -137,7 +147,6 @@ public class ServiceHPPZ017 extends ServiceEPBase {
hppz018.setSalesAmount(bigDecimal);
DaoUtils.insert(HPPZ018.INSERT, hppz018);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次数据分解成功!");
} catch (Exception e) {
......
......@@ -36,6 +36,7 @@ public class ServiceHPPZ018 extends ServiceEPBase {
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPPZ018.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo,HPPZ018.QUERY);
}
......
......@@ -44,6 +44,7 @@ public class ServiceHPPZ019 extends ServiceEPBase {
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPPZ019.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPPZ019.FIELD_CONTRACT_DATE,
DateUtils.formatShort(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPPZ019.FIELD_CONTRACT_DATE)));
return super.query(inInfo, HPPZ019.QUERY);
......
......@@ -94,7 +94,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
YEAR DESC
YEAR DESC,STATUS asc
</isEmpty>
</dynamic>
......@@ -181,7 +181,7 @@
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0:否1.是 -->
WHERE
ID = #id#
</update>
......
......@@ -56,6 +56,9 @@
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="year">
YEAR = #year#
</isNotEmpty>
......@@ -89,12 +92,13 @@
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime", <!-- 修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0:否1.是 -->
PARENT_ID as "parentId", <!-- 父级ID -->
YEAR as "year", <!-- 年度 -->
MONTH as "month", <!-- 月份 -->
SALES_CODE as "salesCode", <!-- 销售单号 -->
PLAN_SALES_CODE as "planSalesCode", <!-- 销售计划单号 -->
SALES_AMOUNT as "salesAmount", <!-- 营销额 -->
STATUS as "status" <!-- 状态 0-未审核,1-已审核 -->
STATUS as "status" <!-- 审批状态 0-未审批 1-已审批 -->
FROM ${hpjxSchema}.T_HPPZ018 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
......@@ -102,7 +106,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
YEAR desc,MONTH asc,STATUS asc
</isEmpty>
</dynamic>
......@@ -172,14 +176,15 @@
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除0:否1.是 -->
PARENT_ID, <!-- 父级ID -->
YEAR, <!-- 年度 -->
MONTH, <!-- 月份 -->
SALES_CODE, <!-- 销售单号 -->
PLAN_SALES_CODE, <!-- 销售计划单号 -->
SALES_AMOUNT, <!-- 营销额 -->
STATUS
STATUS <!-- 审批状态 0-未审批 1-已审批 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #year#, #month#, #salesCode#, #planSalesCode#, #salesAmount#, #status#)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #parentId#, #year#, #month#, #salesCode#, #planSalesCode#, #salesAmount#, #status#)
</insert>
<delete id="delete">
......@@ -194,11 +199,23 @@
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0:否1.是 -->
WHERE
ID = #id#
</update>
<!--parentId逻辑删除-->
<update id="deleteByParentId">
UPDATE ${hpjxSchema}.T_HPPZ018
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0:否1.是 -->
WHERE
PARENT_ID = #parentId#
</update>
<!--审批状态-->
<update id="updateStatus">
UPDATE ${hpjxSchema}.T_HPPZ018
......@@ -223,12 +240,13 @@
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
PARENT_ID = #parentId#, <!-- 父级ID -->
YEAR = #year#, <!-- 年度 -->
MONTH = #month#, <!-- 月份 -->
SALES_CODE = #salesCode#, <!-- 销售单号 -->
PLAN_SALES_CODE = #planSalesCode#, <!-- 销售计划单号 -->
SALES_AMOUNT = #salesAmount#, <!-- 营销额 -->
STATUS = #status#
STATUS = #status# <!-- 审批状态 0-未审批 1-已审批 -->
WHERE
ID = #id#
</update>
......@@ -238,7 +256,7 @@
CONCAT(YEAR,MONTH) as "yearMonth",
PLAN_SALES_CODE AS "planSalesCode"
FROM ${hpjxSchema}.T_HPPZ018
WHERE 1=1
WHERE 1=1 AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......
......@@ -832,6 +832,7 @@ public class HPPZTools {
AssertUtils.isNull(year, String.format("年份不能为空", year));
Map queryMap = new HashMap();
queryMap.put("year", year);
queryMap.put(HPPZ017.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
List<HPPZ017> results = DaoBase.getInstance().query(HPPZ017.QUERY, queryMap);
return results;
......@@ -859,9 +860,40 @@ public class HPPZTools {
AssertUtils.isNull(year, String.format("年份不能为空", year));
Map queryMap = new HashMap();
queryMap.put("year", year);
List<HPPZ018> results = DaoBase.getInstance().query(HPPZ017.QUERY, queryMap);
queryMap.put(HPPZ018.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
List<HPPZ018> results = DaoBase.getInstance().query(HPPZ018.QUERY, queryMap);
return results;
}
public static List<HPPZ018> getPanentId(Long id){
AssertUtils.isNull(id, String.format("id不能为空", id));
return getPanentId(id,null);
}
public static List<HPPZ018> getPanentId(Long id,Integer status){
AssertUtils.isNull(id, String.format("id不能为空", id));
Map queryMap = new HashMap();
queryMap.put(HPPZ018.FIELD_PARENT_ID, id);
if (status != null) {
queryMap.put(HPPZ018.FIELD_STATUS,status);
}
List<HPPZ018> results = DaoBase.getInstance().query(HPPZ018.QUERY, queryMap);
AssertUtils.isNotEmpty(results, String.format("销售目标分解的销售计划已经审批通过,无法删除"));
return results;
}
}
public static class HpPz019 {
public static List<HPPZ019> getPlanSalesCode(String planSalesCode){
AssertUtils.isNull(planSalesCode, String.format("销售计划单号不能为空", planSalesCode));
Map queryMap = new HashMap();
queryMap.put(HPPZ019.FIELD_PLAN_SALES_CODE, planSalesCode);
queryMap.put(HPPZ019.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
List<HPPZ019> results = DaoBase.getInstance().query(HPPZ019.QUERY, queryMap);
//AssertUtils.isEmpty(results, String.format("部件编码[%s]信息不存在", prdtCode));
return results;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment