Browse Source

2023-12-13 参数采集单和采集模版,基础实体修改

develop
zhousq 12 months ago
parent
commit
614678b08b
  1. 30
      lzbi-module/src/main/java/com/lzbi/asset/domain/DcBusiWorkReadConfig.java
  2. 15
      lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanTargetMonth.java
  3. 1
      lzbi-module/src/main/java/com/lzbi/code/mapper/DcBaseCoderuleDefineMapper.java
  4. 3
      lzbi-module/src/main/java/com/lzbi/code/service/CodeNoGenerater.java
  5. 7
      lzbi-module/src/main/java/com/lzbi/code/service/DcBaseCoderuleDefineService.java
  6. 42
      lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamCollectBill.java
  7. 2
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelMaster.java
  8. 25
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelSub.java
  9. 4
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillMaster.java
  10. 15
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java
  11. 4
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiBillModelMasterMapper.java
  12. 9
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiBillModelMasterService.java
  13. 3
      lzbi-module/src/main/resources/mapper/asset/DcBaseCoderuleDefineMapper.xml
  14. 17
      lzbi-module/src/main/resources/mapper/draft/DcBusiBillModelMasterMapper.xml

30
lzbi-module/src/main/java/com/lzbi/asset/domain/DcBusiWorkReadConfig.java

@ -2,6 +2,7 @@ package com.lzbi.asset.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.lzbi.common.annotation.Excel;
import com.lzbi.module.base.BaseModuleEntity;
@ -19,67 +20,72 @@ public class DcBusiWorkReadConfig extends BaseModuleEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@Excel(name = "主键")
@TableId(type= IdType.AUTO)
private Long id;
@ApiModelProperty(name = "公司ID", notes = "")
/** 公司ID */
private Long companyId;
/** 公司名称 */
@Excel(name = "公司名称")
@ApiModelProperty(name = "公司名称", notes = "")
private String companyName;
/** 组织机构名称 */
@Excel(name = "组织机构名称")
@ApiModelProperty(name = "组织机构名称", notes = "")
private String organizeName;
/** 组织机构ID */
@ApiModelProperty(name = "组织机构ID", notes = "")
private Long oragnizeId;
/** 统计单元编码 */
@ApiModelProperty(name = "统计单元编码", notes = "")
private String assetCode;
/** 统计单元名称 */
@Excel(name = "统计单元名称")
@ApiModelProperty(name = "统计单元名称", notes = "")
private String assetName;
/** 统计参数编码 */
@ApiModelProperty(name = "统计参数编码", notes = "")
private String assetParamCode;
/** 目标参数编码 */
@ApiModelProperty(name = "目标参数编码", notes = "")
private String goalParamCode;
/** 目标参数名称 */
@Excel(name = "目标参数名称")
@ApiModelProperty(name = "目标参数名称", notes = "")
private String goalParamName;
/** 目标参数扩展1 */
@Excel(name = "目标参数扩展1")
@ApiModelProperty(name = "目标参数扩展1", notes = "")
private String goalParamExt1;
/** 目标参数扩展2 */
@Excel(name = "目标参数扩展2")
@ApiModelProperty(name = "目标参数扩展2", notes = "")
private String goalParamExt2;
/** 读取数值类型 */
@Excel(name = "读取数值类型")
@ApiModelProperty(name = "读取数值类型", notes = "")
private String goalParamType;
/** 数据来源 */
@Excel(name = "数据来源")
@ApiModelProperty(name = "数据来源", notes = "")
private String goalSource;
/** 生产专业编码 */
@ApiModelProperty(name = "生产专业编码", notes = "")
private String assetFieldCode;
/** 生产专业名称 */
@Excel(name = "生产专业名称")
@ApiModelProperty(name = "生产专业名称", notes = "")
private String assetFieldName;
/** 统计单元参数名称 */
@Excel(name = "统计单元参数名称")
@ApiModelProperty(name = "统计单元参数名称", notes = "")
private String assetParamName;
@ApiModelProperty(name = "目标参数名称", notes = "")
private Integer paramCounts;
}

15
lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanTargetMonth.java

@ -22,21 +22,6 @@ public class DcBusiPlanTargetMonth extends BaseModuleEntity
{
private static final long serialVersionUID = 1L;
/** 创建人 */
private String createdBy;
/** 创建时间 */
private Date createdTime;
/** 更新人 */
private String updatedBy;
/** 更新时间 */
private Date updatedTime;
/** 主键 */
private Long id;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyName;

1
lzbi-module/src/main/java/com/lzbi/code/mapper/DcBaseCoderuleDefineMapper.java

@ -38,6 +38,7 @@ public interface DcBaseCoderuleDefineMapper extends BaseMapper<DcBaseCoderuleDef
* @return 结果
*/
public int insertDcBaseCoderuleDefineDao(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao);
public int insertSerial(Long ruleId);
/**
* 修改编码规则定义

3
lzbi-module/src/main/java/com/lzbi/code/service/CodeNoGenerater.java

@ -59,6 +59,9 @@ public class CodeNoGenerater {
}
private String getSerial(long rid){
DcBaseCoderuleSerialDao serialByRuleId = dcBaseCoderuleDefineService.getSerialByRuleId(rid);
if(StringUtils.isNull(serialByRuleId)){
return null;
}
if(dcBaseCoderuleDefineService.updateSerial(serialByRuleId.getRevision(),serialByRuleId.getSerialId()+1,serialByRuleId.getId())>0){
return String.valueOf(serialByRuleId.getSerialId()+1);
}else{

7
lzbi-module/src/main/java/com/lzbi/code/service/DcBaseCoderuleDefineService.java

@ -57,7 +57,12 @@ public class DcBaseCoderuleDefineService extends ServiceImpl<DcBaseCoderuleDefin
public int insertDcBaseCoderuleDefineDao(DcBaseCoderuleDefineDao dcBaseCoderuleDefineDao)
{
dcBaseCoderuleDefineDao.setCreatedTime(DateUtils.getNowDate());
return baseMapper.insertDcBaseCoderuleDefineDao(dcBaseCoderuleDefineDao);
int ret=baseMapper.insertDcBaseCoderuleDefineDao(dcBaseCoderuleDefineDao);
DcBaseCoderuleDefineDao insert = baseMapper.selectDcBaseCoderuleDefineDaoList(dcBaseCoderuleDefineDao).get(0);
if(StringUtils.isNotNull(insert)){
baseMapper.insertSerial(insert.getId());
}
return ret;
}
/**

42
lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiParamCollectBill.java

@ -10,6 +10,7 @@ import com.lzbi.code.service.DcBaseCoderuleDefineService;
import com.lzbi.common.annotation.Log;
import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.core.domain.model.LoginUser;
import com.lzbi.common.core.page.TableDataInfo;
import com.lzbi.common.enums.BusinessType;
@ -22,6 +23,7 @@ import com.lzbi.draft.domain.DcBusiParamBillMaster;
import com.lzbi.draft.domain.DcBusiParamBillSub;
import com.lzbi.draft.service.DcBusiBillModelMasterService;
import com.lzbi.draft.service.DcBusiParamBillMasterService;
import com.lzbi.system.service.ISysDeptService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@ -53,6 +55,8 @@ public class DcBusiParamCollectBill extends BaseController
private DcBaseCoderuleDefineService dcBaseCoderuleDefineService;
@Autowired
private CodeNoGenerater codeNoGenerater;
@Autowired
private ISysDeptService sysDeptService;
/**
* 查询参数采集录入
* 根据
@ -87,6 +91,13 @@ public class DcBusiParamCollectBill extends BaseController
List<DcBusiBillModelMaster> list = dcBusiBillModelMasterService.selectDcBusiBillModelMasterList(dcBusiBillModelMaster);
return getDataTable(list);
}
@GetMapping("/userModelById/{mid}")
public AjaxResult getUserModelById(@PathVariable Long mid)
{
DcBusiBillModelMaster dcBusiBillModelMaster = dcBusiBillModelMasterService.selectDcBusiBillModelMasterById(mid);
return AjaxResult.success(dcBusiBillModelMaster);
}
/**
* 根据根据公司查询模版现根据角色ID进行过滤
* 根据
@ -130,27 +141,33 @@ public class DcBusiParamCollectBill extends BaseController
dcBusiBillModelMaster.setBillModelPoint(dcBusiParamBillMaster.getCountTimes());
dcBusiBillModelMaster.setRoleId(loginUser.getUser().getRoleId());
dcBusiBillModelMaster.setDeptId(loginUser.getDeptId());
dcBusiBillModelMaster.setCompanyId(dcBusiParamBillMaster.getCompanyId());
dcBusiBillModelMaster.setCompanyName(dcBusiParamBillMaster.getCompanyName());
dcBusiBillModelMaster.setOrgId(dcBusiParamBillMaster.getOragnizeId());
dcBusiBillModelMaster.setOrgName(dcBusiBillModelMaster.getOrgName());
long deptId=dcBusiParamBillMaster.getCompanyId();
SysDept sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ;
dcBusiBillModelMaster.setCompanyId(deptId);
dcBusiBillModelMaster.setCompanyName(sysDept.getDeptName());
deptId=dcBusiParamBillMaster.getOragnizeId();
dcBusiBillModelMaster.setOrgId(deptId);
sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ;
dcBusiBillModelMaster.setOrgName(sysDept.getDeptName());
dcBusiBillModelMaster.setDataState("0");
dcBusiBillModelMaster.setUseState("1");
dcBusiBillModelMaster.setFieldCode(dcBusiParamBillMaster.getFieldCode());
dcBusiBillModelMaster.setFieldName(dcBusiParamBillMaster.getFieldName());
dcBusiBillModelMaster.setBillModelNo(billModelNo);
dcBusiBillModelMaster.setBillModelName(dcBusiParamBillMaster.getBillName());
dcBusiBillModelMaster.setBillModelName(dcBusiParamBillMaster.getBiilModelName());
List<DcBusiBillModelSub> dcBusiBillModelSubList=new ArrayList<>();
List<DcBusiParamBillSub> dcBusiParamBillSubList = dcBusiParamBillMaster.getDcBusiParamBillSubList();
dcBusiParamBillSubList.forEach(item -> {
JSONArray jsonArray=Optional.ofNullable(JSONArray.from(dcBusiParamBillMaster.getSubDatas())).orElse(new JSONArray());
jsonArray.forEach(item -> {
JSONObject jsb = JSONObject.from(item);
DcBusiBillModelSub modelSub=new DcBusiBillModelSub();
modelSub.setBillModelNo(billModelNo);
modelSub.setAssetCode(item.getAssetCode());
modelSub.setAssetName(item.getAssetName());
modelSub.setAssetCode(jsb.getString("assetCode"));
modelSub.setAssetName(jsb.getString("assetName"));
//modelSub.setAssetId(item.get);
modelSub.setAssetUnitCode(item.getParamCode());
modelSub.setAssetUnitName(item.getParamName());
modelSub.setAssetUnitCode(jsb.getString("paramCode"));
modelSub.setAssetUnitName(jsb.getString("paramName"));
modelSub.setAssetUnitType("P");
modelSub.setAUnit(jsb.getString("paramUint"));
dcBusiBillModelSubList.add(modelSub);
});
dcBusiBillModelMaster.setDcBusiBillModelSubList(dcBusiBillModelSubList);
@ -211,7 +228,8 @@ public class DcBusiParamCollectBill extends BaseController
return AjaxResult.success(dcBusiParamBillMasterService.insertDcBusiParamBillMasterDao(dcBusiParamBillMaster));
}
private String getBillModelNo(){
DcBusiCoderuleConfigDao ruleIdByBusicode = dcBaseCoderuleDefineService.getRuleIdByBusicode("BILL_MODEL_NO");
DcBusiCoderuleConfigDao ruleIdByBusicode =Optional.ofNullable(dcBaseCoderuleDefineService.getRuleIdByBusicode("BILL_MODEL_NO")).orElse(new DcBusiCoderuleConfigDao()) ;
DcBaseCoderuleDefineDao ruleDao = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoById(ruleIdByBusicode.getRuleId());
return codeNoGenerater.getCode(ruleDao);
}

2
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelMaster.java

@ -21,7 +21,7 @@ import com.lzbi.module.base.BaseModuleEntity;
* @date 2023-12-11
*/
@Data
@Accessors(chain = true)
@Accessors(chain=true)
public class DcBusiBillModelMaster extends BaseModuleEntity
{
/** 主键 */

25
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiBillModelSub.java

@ -1,5 +1,6 @@
package com.lzbi.draft.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -13,7 +14,6 @@ import com.lzbi.module.base.BaseModuleEntity;
* @author zhousq
* @date 2023-12-11
*/
@Data
@Accessors(chain = true)
public class DcBusiBillModelSub extends BaseModuleEntity
@ -21,33 +21,38 @@ public class DcBusiBillModelSub extends BaseModuleEntity
private static final long serialVersionUID = 1L;
/** 模版编码号 */
@Excel(name = "模版编码号")
@ApiModelProperty(name = "模版编码号", notes = "")
private String billModelNo;
/** 统计单元编码 */
@Excel(name = "统计单元编码")
@ApiModelProperty(name = "统计单元编码", notes = "")
private String assetCode;
/** 统计单元名称 */
@Excel(name = "统计单元名称")
@ApiModelProperty(name = "统计单元名称", notes = "")
private String assetName;
/** 指标【参数】编码 */
@Excel(name = "指标【参数】编码")
@ApiModelProperty(name = "指标【参数】编码", notes = "")
private String assetUnitCode;
/** 指标【参数】名称 */
@Excel(name = "指标【参数】名称")
@ApiModelProperty(name = "指标【参数】名称", notes = "")
private String assetUnitName;
@ApiModelProperty(name = "指标【参数】别名", notes = "")
private String assetUnitAlialsName;
/** 数据类别;T指标P参数 */
@Excel(name = "数据类别;T指标P参数")
@ApiModelProperty(name = "数据类别;T指标P参数", notes = "")
private String assetUnitType;
/** 主键 */
private Long id;
// /** 主键 */
// private Long id;
/** 统计单元ID */
@Excel(name = "统计单元ID")
@ApiModelProperty(name = "统计单元ID", notes = "")
private Long assetId;
private String aUnit;
}

4
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamBillMaster.java

@ -67,7 +67,9 @@ public class DcBusiParamBillMaster extends BaseModuleEntity
// @ApiModelProperty(name = "统计单元名称",notes = "")
// private String assetName ;
@ApiModelProperty(name = "单据名称",notes = "")
private String billName ;
private String biilModelName ;
@ApiModelProperty(name = "模版编码",notes = "")
private String billModelNo ;
@ApiModelProperty(name = "统计日期",notes = "")
private String countDate ;
@ApiModelProperty(name = "统计整点数",notes = "")

15
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java

@ -19,21 +19,6 @@ public class DcBusiParamDraftDay extends BaseModuleEntity
{
private static final long serialVersionUID = 1L;
/** 创建人 */
private String createdBy;
/** 创建时间 */
private Date createdTime;
/** 更新人 */
private String updatedBy;
/** 更新时间 */
private Date updatedTime;
/** 主键 */
@Excel(name = "主键")
private Long id;
/** 公司编码 */
private Integer companyId;

4
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiBillModelMasterMapper.java

@ -53,7 +53,7 @@ public interface DcBusiBillModelMasterMapper extends BaseMapper<DcBusiBillModelM
* @return 结果
*/
public int deleteDcBusiBillModelMasterById(Long id);
public int deleteDcBusiBillModelMasterByNo(String billNo);
/**
* 批量删除录入配置
*
@ -85,5 +85,5 @@ public interface DcBusiBillModelMasterMapper extends BaseMapper<DcBusiBillModelM
* @param id 录入配置ID
* @return 结果
*/
public int deleteDcBusiBillModelSubByBillModelNo(Long id);
public int deleteDcBusiBillModelSubByBillModelNo(String id);
}

9
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiBillModelMasterService.java

@ -71,7 +71,7 @@ public class DcBusiBillModelMasterService extends ServiceImpl<DcBusiBillModelMas
public int updateDcBusiBillModelMaster(DcBusiBillModelMaster dcBusiBillModelMaster)
{
dcBusiBillModelMaster.setUpdatedTime(DateUtils.getNowDate());
baseMapper.deleteDcBusiBillModelSubByBillModelNo(dcBusiBillModelMaster.getId());
baseMapper.deleteDcBusiBillModelSubByBillModelNo(dcBusiBillModelMaster.getBillModelNo());
insertDcBusiBillModelSub(dcBusiBillModelMaster);
return baseMapper.updateDcBusiBillModelMaster(dcBusiBillModelMaster);
}
@ -98,10 +98,11 @@ public class DcBusiBillModelMasterService extends ServiceImpl<DcBusiBillModelMas
*/
@Transactional
public int deleteDcBusiBillModelMasterById(Long id)
public int deleteDcBusiBillModelMasterById(String id)
{
baseMapper.deleteDcBusiBillModelSubByBillModelNo(id);
return baseMapper.deleteDcBusiBillModelMasterById(id);
baseMapper.deleteDcBusiBillModelSubByBillModelNo(id);
return baseMapper.deleteDcBusiBillModelMasterByNo(id);
}
/**

3
lzbi-module/src/main/resources/mapper/asset/DcBaseCoderuleDefineMapper.xml

@ -129,6 +129,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="codeSplitFlag != null">#{codeSplitFlag},</if>
</trim>
</insert>
<insert id="insertSerial" parameterType="long" useGeneratedKeys="true" keyProperty="id">
insert into dc_base_coderule_serial(code_rule_id,serial_id,revision) values (#{param1},0,0)
</insert>
<update id="updateDcBaseCoderuleDefineDao" parameterType="DcBaseCoderuleDefineDao">
update dc_base_coderule_define

17
lzbi-module/src/main/resources/mapper/draft/DcBusiBillModelMasterMapper.xml

@ -42,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="assetUnitType" column="sub_asset_unit_type" />
<result property="id" column="sub_id" />
<result property="assetId" column="sub_asset_id" />
<result property="assetUnitAlialsName" column="sub_asset_unit_alials_name" />
<result property="aUnit" column="sub_a_unit" />
</resultMap>
<sql id="selectDcBusiBillModelMasterVo">
@ -69,9 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcBusiBillModelMasterById" parameterType="Long" resultMap="DcBusiBillModelMasterDcBusiBillModelSubResult">
select a.tenant_id, a.revision, a.created_by, a.created_time, a.updated_by, a.updated_time, a.delete_by, a.delete_time, a.dept_id, a.role_id, a.bill_model_no, a.bill_model_name, a.field_code, a.company_name, a.company_id, a.bill_model_point, a.org_name, a.org_id, a.id, a.data_state, a.use_state, a.field_name,
b.bill_model_no as sub_bill_model_no, b.asset_code as sub_asset_code, b.asset_name as sub_asset_name, b.asset_unit_code as sub_asset_unit_code, b.asset_unit_name as sub_asset_unit_name, b.asset_unit_type as sub_asset_unit_type, b.id as sub_id, b.asset_id as sub_asset_id
b.bill_model_no as sub_bill_model_no, b.asset_code as sub_asset_code, b.asset_name as sub_asset_name, b.asset_unit_code as sub_asset_unit_code, b.asset_unit_name as sub_asset_unit_name, b.asset_unit_type as sub_asset_unit_type, b.id as sub_id, b.asset_id as sub_asset_id,asset_unit_alials_name as sub_asset_unit_alials_name,a_unit as sub_a_unit
from dc_busi_bill_model_master a
left join dc_busi_bill_model_sub b on b.bill_model_no = a.id
left join dc_busi_bill_model_sub b on b.bill_model_no = a.bill_model_no
where a.id = #{id}
</select>
@ -156,7 +159,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteDcBusiBillModelMasterById" parameterType="Long">
delete from dc_busi_bill_model_master where id = #{id}
</delete>
<delete id="deleteDcBusiBillModelMasterByNo" parameterType="String">
delete from dc_busi_bill_model_master where bill_model_no = #{billNo}
</delete>
<delete id="deleteDcBusiBillModelMasterByIds" parameterType="String">
delete from dc_busi_bill_model_master where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
@ -171,14 +176,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<delete id="deleteDcBusiBillModelSubByBillModelNo" parameterType="Long">
<delete id="deleteDcBusiBillModelSubByBillModelNo" parameterType="String">
delete from dc_busi_bill_model_sub where bill_model_no = #{billModelNo}
</delete>
<insert id="batchDcBusiBillModelSub">
insert into dc_busi_bill_model_sub( bill_model_no, asset_code, asset_name, asset_unit_code, asset_unit_name, asset_unit_type, id, asset_id) values
insert into dc_busi_bill_model_sub( bill_model_no, asset_code, asset_name, asset_unit_code, asset_unit_name, asset_unit_type, id, asset_id,a_unit,asset_unit_alials_name) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.billModelNo}, #{item.assetCode}, #{item.assetName}, #{item.assetUnitCode}, #{item.assetUnitName}, #{item.assetUnitType}, #{item.id}, #{item.assetId})
( #{item.billModelNo}, #{item.assetCode}, #{item.assetName}, #{item.assetUnitCode}, #{item.assetUnitName}, #{item.assetUnitType}, #{item.id}, #{item.assetId},#{item.aUnit},#{item.assetUnitAlialsName})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save