feature:客户信息bug修复、集团物料bug修复、公司物料bug修复、结算单基础开发、结算单单位换算开发

release
gaorl 2 years ago
parent f293e312fa
commit bd0698b2eb
  1. 2
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/dao/BuyerMapper.java
  2. 2
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/model/BuyerEntity.java
  3. 13
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java
  4. 8
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/controller/CommodityController.java
  5. 2
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/CommodityService.java
  6. 6
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityCodeModifyLogServiceImpl.java
  7. 21
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java
  8. 111
      order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml
  9. 10
      order-management-base-service/src/main/resources/mybatis/mapper/CommodityCodeModifyLogDao.xml
  10. 4
      order-management-common/src/main/java/com/dxhy/order/constant/ConfigurerInfo.java
  11. 1
      order-management-common/src/main/java/com/dxhy/order/constant/OrderInfoEnum.java
  12. 4
      order-management-consumer/src/main/java/com/dxhy/order/consumer/dao/GroupCommodityCodeMapper.java
  13. 2
      order-management-consumer/src/main/java/com/dxhy/order/consumer/dao/OrderProcessInfoMapper.java
  14. 7
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java
  15. 40
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/impl/GroupCommodityCodeServiceImpl.java
  16. 19
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/controller/OrderInfoController.java
  17. 3
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/OrderInfoService.java
  18. 25
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/OrderInfoServiceImpl.java
  19. 57
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/unitconversion/entity/UnitConversion.java
  20. 10
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/unitconversion/model/UnitConversionDTO.java
  21. 4
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/api/InvoiceOpenGateRestApi.java
  22. 9
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/api/InvoiceRestApiV6.java
  23. 127
      order-management-consumer/src/main/resources/mybatis/mapper/GroupCommodityCodeMapper.xml
  24. 27
      order-management-consumer/src/main/resources/mybatis/mapper/OrderProcessInfoMapper.xml
  25. 14
      order-management-consumer/src/main/resources/mybatis/mapper/UnitConversionDao.xml
  26. 1
      order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/dao/OrderItemInfoMapper.java
  27. 17
      order-management-invoice/src/main/resources/mybatis/mapper/OrderItemInfoMapper.xml

@ -40,7 +40,7 @@ public interface BuyerMapper {
*/ */
int insertBuyer(BuyerEntity buyerEntity); int insertBuyer(BuyerEntity buyerEntity);
int batchInsertBuyerDetail(List<BuyerEntityDetail> buyerEntityDetails); int batchInsertBuyerDetail(@Param("buyerEntityDetails") List<BuyerEntityDetail> buyerEntityDetails);
int deleteBuyerDetail(String buyerManageId); int deleteBuyerDetail(String buyerManageId);

@ -133,4 +133,6 @@ public class BuyerEntity implements Serializable {
// 默认银行账户的索引7 // 默认银行账户的索引7
private Integer bankDefaultIndex; private Integer bankDefaultIndex;
private String synchronizeOrders;
} }

@ -343,6 +343,7 @@ public class BuyerServiceImpl implements BuyerService {
if(ConfigureConstant.STRING_1.equals(buyerEntity.getIsEdit())){ if(ConfigureConstant.STRING_1.equals(buyerEntity.getIsEdit())){
t.setUpdateUser(""); t.setUpdateUser("");
t.setUpdateTime(new Date()); t.setUpdateTime(new Date());
t.setBuyerManageId(buyerEntity.getId());
}else{ }else{
t.setBuyerManageId(buyerId); t.setBuyerManageId(buyerId);
t.setCreateUser(""); t.setCreateUser("");
@ -356,13 +357,14 @@ public class BuyerServiceImpl implements BuyerService {
} }
}); });
} }
if(buyerEntity.getBuyerEntityDetail() != null && buyerEntity.getBuyerEntityDetail().size()>0){
buyerMapper.deleteBuyerDetail(buyerEntity.getId());
buyerMapper.batchInsertBuyerDetail(buyerEntity.getBuyerEntityDetail());
}
if (existBuyer != null) {//StringUtils.isNotBlank(buyerEntity.getId()) if (existBuyer != null) {//StringUtils.isNotBlank(buyerEntity.getId())
buyerEntity.setModifyTime(new Date()); buyerEntity.setModifyTime(new Date());
//更新明细表,最好的办法是先删除后新增 //更新明细表,最好的办法是先删除后新增
buyerMapper.deleteBuyerDetail(buyerEntity.getId());
buyerMapper.batchInsertBuyerDetail(buyerEntity.getBuyerEntityDetail());
int i = buyerMapper.updateBuyer(buyerEntity, shList); int i = buyerMapper.updateBuyer(buyerEntity, shList);
if (i <= 0) { if (i <= 0) {
@ -376,13 +378,16 @@ public class BuyerServiceImpl implements BuyerService {
} }
log.info("{}添加开始执行开始执行 uuid = {}", LOGGER_MSG, buyerId); log.info("{}添加开始执行开始执行 uuid = {}", LOGGER_MSG, buyerId);
buyerEntity.setId(buyerId); buyerEntity.setId(buyerId);
buyerMapper.batchInsertBuyerDetail(buyerEntity.getBuyerEntityDetail());
int i = buyerMapper.insertBuyer(buyerEntity); int i = buyerMapper.insertBuyer(buyerEntity);
if (i <= 0) { if (i <= 0) {
r.put("message", "添加失败").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999); r.put("message", "添加失败").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999);
} }
} }
if("0".equals(buyerEntity.getSynchronizeOrders())){
//更新订单
}
return R.ok().put(OrderManagementConstant.MESSAGE, "保存成功!"); return R.ok().put(OrderManagementConstant.MESSAGE, "保存成功!");
} }

@ -172,14 +172,12 @@ public class CommodityController {
if (ObjectUtil.isNotEmpty(maps)) { if (ObjectUtil.isNotEmpty(maps)) {
return R.error().put(OrderManagementConstant.DATA, maps); return R.error().put(OrderManagementConstant.DATA, maps);
} }
boolean flag = false;
try { try {
flag = commodityService.addOrEditCommodity(commodityCodeEntity); return commodityService.addOrEditCommodity(commodityCodeEntity);
} catch (Exception e) { } catch (Exception e) {
flag = false; return R.error().put(OrderManagementConstant.DATA, "系统异常");
} }
log.info("返回值:{}", flag);
return flag ? R.ok().put("msg", "保存成功") : R.ok().put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999).put("msg", "保存失败");
} }
/** /**

@ -34,7 +34,7 @@ public interface CommodityService {
* @param codeEntity * @param codeEntity
* @return * @return
*/ */
boolean addOrEditCommodity(CommodityCodeEntity codeEntity); R addOrEditCommodity(CommodityCodeEntity codeEntity);
/** /**
* 删除 * 删除

@ -69,14 +69,14 @@ public class CommodityCodeModifyLogServiceImpl implements CommodityCodeModifyLog
return 0; return 0;
} }
Field[] fields = CommodityCodeEntity.class.getFields(); Field[] fields = CommodityCodeEntity.class.getDeclaredFields();
List<CommodityCodeModifyLog> modifyLogs = new ArrayList<>(); List<CommodityCodeModifyLog> modifyLogs = new ArrayList<>();
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
Field tempField = fields[i]; Field tempField = fields[i];
tempField.setAccessible(true); tempField.setAccessible(true);
try { try {
Object originValue = tempField.get(originOne); Object originValue = tempField.get(originOne) == null?"":tempField.get(originOne);
Object newValue = tempField.get(newOne); Object newValue = tempField.get(newOne) == null?"":tempField.get(newOne);
if (!originValue.equals(newValue)) { if (!originValue.equals(newValue)) {
CommodityCodeModifyLog modifyLog = new CommodityCodeModifyLog(); CommodityCodeModifyLog modifyLog = new CommodityCodeModifyLog();
modifyLog.setId(baseService.getGenerateShotKey()); modifyLog.setId(baseService.getGenerateShotKey());

@ -101,12 +101,13 @@ public class CommodityServiceImpl implements CommodityService {
*/ */
@Override @Override
@Transactional @Transactional
public boolean addOrEditCommodity(CommodityCodeEntity codeEntity) { public R addOrEditCommodity(CommodityCodeEntity codeEntity) {
List<String> shList = NsrsbhUtils.transShListByNsrsbh(codeEntity.getXhfNsrsbh()); List<String> shList = NsrsbhUtils.transShListByNsrsbh(codeEntity.getXhfNsrsbh());
boolean flag; boolean flag;
//判断保存或者修改操作 //判断保存或者修改操作
String id = codeEntity.getId(); String id = codeEntity.getId();
Map<String,String> map = new HashMap<>();
CommodityCodeEntity commodityCodeEntity = commodityMapper.queryCommodityById(id, "", shList); CommodityCodeEntity commodityCodeEntity = commodityMapper.queryCommodityById(id, "", shList);
if (ObjectUtil.isNotEmpty(commodityCodeEntity)) { if (ObjectUtil.isNotEmpty(commodityCodeEntity)) {
log.debug("修改操作 id = {}", id); log.debug("修改操作 id = {}", id);
@ -118,12 +119,13 @@ public class CommodityServiceImpl implements CommodityService {
} }
// 记录修改记录 // 记录修改记录
Long userId = userInfoService.getUser().getUserId(); Long userId = userInfoService.getUser().getUserId();
int i = commodityCodeModifyLogService.saveCommodityCodeDifferenceBetween2(commodityCodeEntity, codeEntity, userId);
if(i != -1){
i = commodityMapper.updateCommodity(codeEntity, shList);
}
flag = i >= 0; if(commodityCodeModifyLogService.saveCommodityCodeDifferenceBetween2(commodityCodeEntity, codeEntity, userId) == -1){
R.error().put(OrderManagementConstant.DATA, "数据未进行修改,无需保存");
}
if(commodityMapper.updateCommodity(codeEntity, shList) <= 0){
R.error().put(OrderManagementConstant.DATA, "更新物料信息失败,请联系管理员");
}
} else { } else {
codeEntity.setDataSource(TaxClassCodeEnum.DATA_SOURCE_1.getKey()); codeEntity.setDataSource(TaxClassCodeEnum.DATA_SOURCE_1.getKey());
@ -138,11 +140,12 @@ public class CommodityServiceImpl implements CommodityService {
codeEntity.setDataState(TaxClassCodeEnum.DATA_STATE_1.getKey()); codeEntity.setDataState(TaxClassCodeEnum.DATA_STATE_1.getKey());
} }
int i = commodityMapper.insertCommodity(codeEntity); if(commodityMapper.insertCommodity(codeEntity) <= 0){
R.error().put(OrderManagementConstant.DATA, "新增物料信息失败,请联系管理员");
}
flag = i > 0;
} }
return flag; return R.ok();
} }
/** /**

@ -30,13 +30,11 @@
<result column="buyer_manage_id" jdbcType="VARCHAR" property="buyerManageId"/> <result column="buyer_manage_id" jdbcType="VARCHAR" property="buyerManageId"/>
<result column="bank_name" jdbcType="VARCHAR" property="bankName"/> <result column="bank_name" jdbcType="VARCHAR" property="bankName"/>
<result column="bank_account" jdbcType="VARCHAR" property="bankAccount"/> <result column="bank_account" jdbcType="VARCHAR" property="bankAccount"/>
<result column="address" jdbcType="VARCHAR" property="address"/> <result column="bmid_address" jdbcType="VARCHAR" property="address"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/> <result column="bmid_phone" jdbcType="VARCHAR" property="phone"/>
<result column="default_mark" jdbcType="VARCHAR" property="defaultMark"/> <result column="default_mark" jdbcType="VARCHAR" property="defaultMark"/>
<result column="create_user" jdbcType="VARCHAR" property="createUser"/> <result column="create_user" jdbcType="VARCHAR" property="createUser"/>
<result column="update_user" jdbcType="VARCHAR" property="updateUser"/> <result column="update_user" jdbcType="VARCHAR" property="updateUser"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</collection> </collection>
</resultMap> </resultMap>
@ -59,8 +57,8 @@
bmi.sjh, bmi.sjh,
bmi.remarks, bmi.remarks,
bmi.create_user_id, bmi.create_user_id,
bmi.DATE_FORMAT(create_time, '%Y-%m-%d') createTime, DATE_FORMAT(bmi.create_time, '%Y-%m-%d') createTime,
bmi.DATE_FORMAT(modify_time, '%Y-%m-%d') modifyTime, DATE_FORMAT(bmi.modify_time, '%Y-%m-%d') modifyTime,
bmi.modify_user_id, bmi.modify_user_id,
bmi.ghf_qylx, bmi.ghf_qylx,
bmi.xhf_nsrsbh, bmi.xhf_nsrsbh,
@ -68,7 +66,16 @@
bmi.buyer_code, bmi.buyer_code,
bmi.create_time, bmi.create_time,
bmi.status, bmi.status,
bmid.* bmid.consumer_id,
bmid.buyer_manage_id,
bmid.bank_name,
bmid.bank_account,
bmid.address as bmid_address,
bmid.phone as bmid_phone,
bmid.default_mark,
bmid.create_user,
bmid.update_user
FROM FROM
buyer_manage_info bmi left join buyer_manage_info_detail bmid on bmi.id = bmid.buyer_manage_id buyer_manage_info bmi left join buyer_manage_info_detail bmid on bmi.id = bmid.buyer_manage_id
<where> <where>
@ -291,83 +298,27 @@
<insert id="batchInsertBuyerDetail" parameterType="com.dxhy.order.baseservice.module.buyer.model.BuyerEntityDetail" useGeneratedKeys="true" keyProperty="consumerId"> <insert id="batchInsertBuyerDetail" parameterType="com.dxhy.order.baseservice.module.buyer.model.BuyerEntityDetail" useGeneratedKeys="true" keyProperty="consumerId">
<bind name="dataType" value="${dataType}"/> <bind name="dataType" value="${dataType}"/>
INSERT INTO buyer_manage_info_detail INSERT INTO buyer_manage_info_detail (
<trim prefix="(" suffix=")" suffixOverrides=","> buyer_manage_id,bank_name,bank_account,address,phone,default_mark,create_user,update_user,create_time,update_time
) values
<foreach collection="buyerEntityDetails" item="buyerDetail" index="index" separator=",">
<!--<if test="consumerId != null">--> <!--<if test="consumerId != null">-->
<!--consumer_id,--> <!--#{consumerId,jdbcType=VARCHAR},-->
<!--</if>--> <!--</if>-->
<if test="buyerManageId != null"> (#{buyerDetail.buyerManageId,jdbcType=VARCHAR},
buyer_manage_id, #{buyerDetail.bankName,jdbcType=VARCHAR},
</if> #{buyerDetail.bankAccount,jdbcType=VARCHAR},
<if test="bankName != null"> #{buyerDetail.address,jdbcType=VARCHAR},
bank_name, #{buyerDetail.phone,jdbcType=VARCHAR},
</if> #{buyerDetail.defaultMark,jdbcType=VARCHAR},
<if test="bankAccount != null"> #{buyerDetail.createUser,jdbcType=VARCHAR},
bank_account, #{buyerDetail.updateUser,jdbcType=VARCHAR},
</if> now(),
<if test="address != null"> now())
address, </foreach>
</if>
<if test="phone != null">
phone,
</if>
<if test="defaultMark != null">
default_mark,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="updateUser != null">
update_user,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values">
<foreach collection="buyerEntityDetails" item="buyerDetail" index="index" open="(" separator="," close=")">
<!--<if test="consumerId != null">-->
<!--#{consumerId,jdbcType=VARCHAR},-->
<!--</if>-->
<if test="buyerManageId != null">
#{buyerManageId,jdbcType=VARCHAR},
</if>
<if test="bankName != null">
#{bankName,jdbcType=VARCHAR},
</if>
<if test="bankAccount != null">
#{bankAccount,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="defaultMark != null">
#{defaultMark,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="updateUser != null">
#{updateUser,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
now(),
</if>
<if test="updateTime != null">
now(),
</if>
</foreach>
</trim>
</insert> </insert>
<delete id="deleteBuyerDetail"> <delete id="deleteBuyerDetail">
DELETE FROM buyer_manage_info_detail where buyer_manage_info = #{buyerManageId,jdbcType=VARCHAR} DELETE FROM buyer_manage_info_detail where buyer_manage_id = #{buyerManageId,jdbcType=VARCHAR}
</delete> </delete>
<!-- 插入数据--> <!-- 插入数据-->

@ -66,11 +66,11 @@
<!--新增所有列--> <!--新增所有列-->
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true"> <insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
insert into commodity_code_modify_log(id,commodity_code_id, `key`, origin_value, new_value, modify_user_id, modify_time) insert into commodity_code_modify_log(id,commodity_code_id, `key`, origin_value, new_value, modify_user_id, modify_time)
values ( values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
(#{item.id}, #{item.commodityCodeId}, #{item.key}, #{item.originValue}, #{item.newValue}, #{item.modifyUserId}, #{item.modifyTime}) (#{item.id}, #{item.commodityCodeId}, #{item.key}, #{item.originValue}, #{item.newValue}, #{item.modifyUserId}, #{item.modifyTime})
</foreach> </foreach>
)
</insert> </insert>
<!--通过主键修改数据--> <!--通过主键修改数据-->

@ -117,6 +117,10 @@ public class ConfigurerInfo {
* 调用进项自动认证 * 调用进项自动认证
*/ */
public static final String transferTojx="transferTojx"; public static final String transferTojx="transferTojx";
/**
* 同步会计信息
*/
public static final String SYNC_ACCOUNT_INFO="syncAccountInfo";
/** /**
* 请求执行状态查询接口 * 请求执行状态查询接口

@ -1259,6 +1259,7 @@ public enum OrderInfoEnum {
INTERFACE_BUSINESS_ID_JXTBSHUJU("FI847","自动认证"), INTERFACE_BUSINESS_ID_JXTBSHUJU("FI847","自动认证"),
INTERFACE_BUSINESS_ID_JXSZC("FI849","进项税转出"), INTERFACE_BUSINESS_ID_JXSZC("FI849","进项税转出"),
INTERFACE_BUSINESS_ID_TBPZH("FI848","票账比对"), INTERFACE_BUSINESS_ID_TBPZH("FI848","票账比对"),
INTERFACE_BUSINESS_ID_ZYKSSFFM("FI005","同步会计信息"),
/** /**
* 发票备注配置项枚举 * 发票备注配置项枚举

@ -21,6 +21,8 @@ public interface GroupCommodityCodeMapper {
*/ */
List<CommodityCodeEntity> queryGroupCommodityCodeList(CommodityCodeEntity commodityCodeEntity); List<CommodityCodeEntity> queryGroupCommodityCodeList(CommodityCodeEntity commodityCodeEntity);
CommodityCodeEntity queryCommodityCodeList(CommodityCodeEntity commodityCodeEntity);
/** /**
* 根据物料编码和销方税号查询物料信息 * 根据物料编码和销方税号查询物料信息
@ -44,6 +46,8 @@ public interface GroupCommodityCodeMapper {
int insertCommodityCode(CommodityCodeEntity entity); int insertCommodityCode(CommodityCodeEntity entity);
int updateCommodityCode(CommodityCodeEntity entity);
int deleteCommodityCodeByXhfNsrsbh(CloneCompanyCommodityDetailDTO dto); int deleteCommodityCodeByXhfNsrsbh(CloneCompanyCommodityDetailDTO dto);
int cloneCommodityCode(@Param("from") CloneCompanyCommodityDetailDTO from, @Param("to") CloneCompanyCommodityDetailDTO to); int cloneCommodityCode(@Param("from") CloneCompanyCommodityDetailDTO from, @Param("to") CloneCompanyCommodityDetailDTO to);

@ -87,6 +87,8 @@ public interface OrderProcessInfoMapper {
*/ */
OrderProcessInfo selectByOrderId(@Param("orderId") String orderId, @Param("shList") List<String> shList); OrderProcessInfo selectByOrderId(@Param("orderId") String orderId, @Param("shList") List<String> shList);
List<OrderProcessInfo> selectByOrderIds(@Param("orderIds") List<String> orderIds, @Param("shList") List<String> shList);
/** /**
* 多维度查询订单处理表 * 多维度查询订单处理表
* *

@ -72,7 +72,12 @@ public class GroupCommodityCodeController {
*/ */
@PostMapping("/quote") @PostMapping("/quote")
public R quote(@RequestBody @Validated QuoteGroupCommodityDTO dto) { public R quote(@RequestBody @Validated QuoteGroupCommodityDTO dto) {
return groupCommodityCodeService.quoteGroupCommodityCode(dto); try {
return groupCommodityCodeService.quoteGroupCommodityCode(dto);
} catch (Exception e) {
e.printStackTrace();
return R.error("引用失败,请联系管理员");
}
} }
@PostMapping("/sync") @PostMapping("/sync")

@ -104,18 +104,20 @@ public class GroupCommodityCodeServiceImpl implements IGroupCommodityCodeService
} }
//CommodityCodeEntity commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(zxbm, quoteGroupCommodityDTO.getXhfNsrsbh()); //CommodityCodeEntity commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(zxbm, quoteGroupCommodityDTO.getXhfNsrsbh());
CommodityCodeEntity commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbhAndEntId(zxbm, quoteGroupCommodityDTO.getXhfNsrsbh(), quoteGroupCommodityDTO.getDeptId()); // CommodityCodeEntity commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbhAndEntId(zxbm, quoteGroupCommodityDTO.getXhfNsrsbh(), quoteGroupCommodityDTO.getDeptId());
// 根据文档4.2.1.2 (6) 若物料编码重复时,引用后不对子公司物料进行更新
if (commodityCodeEntity != null) {
continue;
}
commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(zxbm, "-1"); CommodityCodeEntity commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(zxbm, "-1");
if (commodityCodeEntity == null) { if (commodityCodeEntity == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.error("第" + (i + 1) + "条数据,集团物料不存在"); return R.error("第" + (i + 1) + "条数据,集团物料不存在");
} }
CommodityCodeEntity queryCommodityEntity = new CommodityCodeEntity();
queryCommodityEntity.setXhfNsrsbh(quoteGroupCommodityDTO.getXhfNsrsbh());
queryCommodityEntity.setZxbm(zxbm);
queryCommodityEntity.setCommodityId(commodityCodeEntity.getCommodityId());
queryCommodityEntity = groupCommodityMapper.queryCommodityCodeList(queryCommodityEntity);
CommodityCodeEntity newCommodityCodeEntity = new CommodityCodeEntity(); CommodityCodeEntity newCommodityCodeEntity = new CommodityCodeEntity();
try { try {
@ -125,15 +127,23 @@ public class GroupCommodityCodeServiceImpl implements IGroupCommodityCodeService
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
log.error("{}引用物料异常", LOGGER_MSG, e); log.error("{}引用物料异常", LOGGER_MSG, e);
} }
if(queryCommodityEntity != null){
newCommodityCodeEntity.setId(baseService.getGenerateShotKey()); newCommodityCodeEntity.setId(queryCommodityEntity.getId());
newCommodityCodeEntity.setXhfNsrsbh(quoteGroupCommodityDTO.getXhfNsrsbh()); if (groupCommodityMapper.updateCommodityCode(newCommodityCodeEntity) <= 0) {
newCommodityCodeEntity.setEntId(quoteGroupCommodityDTO.getDeptId()); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
newCommodityCodeEntity.setDataState("0"); return R.error("第" + (i + 1) + "条数据,引用失败");
newCommodityCodeEntity.setXhfMc(quoteGroupCommodityDTO.getXhfMc()); }
if (groupCommodityMapper.insertCommodityCode(newCommodityCodeEntity) <= 0) { }else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); newCommodityCodeEntity.setId(baseService.getGenerateShotKey());
return R.error("第" + (i + 1) + "条数据,引用失败"); newCommodityCodeEntity.setXhfNsrsbh(quoteGroupCommodityDTO.getXhfNsrsbh());
newCommodityCodeEntity.setEntId(quoteGroupCommodityDTO.getDeptId());
newCommodityCodeEntity.setDataState("0");
newCommodityCodeEntity.setXhfMc(quoteGroupCommodityDTO.getXhfMc());
//如果存在则更新
if (groupCommodityMapper.insertCommodityCode(newCommodityCodeEntity) <= 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.error("第" + (i + 1) + "条数据,引用失败");
}
} }
} }

@ -3,6 +3,7 @@ package com.dxhy.order.consumer.modules.order.controller;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.order.constant.ConfigureConstant; import com.dxhy.order.constant.ConfigureConstant;
import com.dxhy.order.constant.OrderInfoContentEnum; import com.dxhy.order.constant.OrderInfoContentEnum;
import com.dxhy.order.constant.OrderInfoEnum; import com.dxhy.order.constant.OrderInfoEnum;
@ -36,10 +37,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
/** /**
@ -413,4 +411,17 @@ public class OrderInfoController {
} }
return R.ok().put(OrderManagementConstant.DATA, pageSlkjlyYxqRsp); return R.ok().put(OrderManagementConstant.DATA, pageSlkjlyYxqRsp);
} }
@PostMapping("/conversionNumByRatio")
@SysLog(operation = "根据比率转换数量", operationDesc = "根据比率转换数量", key = "结算单处理")
public R ratioConversion(@RequestParam("orderInfoIds")String orderInfoIds,@RequestParam("rate")String rate,@RequestParam("xhfNsrsbh")String xhfNsrsbh){
//是否校验通税号
log.info("结算单转换请求参数,勾选订单id:{},转换比率:{},转换税号:{}", JSONObject.toJSONString(orderInfoIds),rate,xhfNsrsbh);
if(StringUtils.isBlank(orderInfoIds)||StringUtils.isBlank(rate)||StringUtils.isBlank(xhfNsrsbh)){
return R.error("请求参数有误");
}
orderInfoService.ratioConversion(Arrays.asList(orderInfoIds.split(",")),rate,xhfNsrsbh);
return R.ok();
}
} }

@ -8,6 +8,7 @@ import com.dxhy.order.consumer.modules.order.model.PageInvoiceItem;
import com.dxhy.order.consumer.modules.order.model.PageKySlReq; import com.dxhy.order.consumer.modules.order.model.PageKySlReq;
import com.dxhy.order.consumer.modules.order.model.PageKySlRsp; import com.dxhy.order.consumer.modules.order.model.PageKySlRsp;
import com.dxhy.order.consumer.modules.order.model.bo.YwlxCountTotalBO; import com.dxhy.order.consumer.modules.order.model.bo.YwlxCountTotalBO;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -196,4 +197,6 @@ public interface OrderInfoService {
List<PageKySlRsp> queryAvailableSlList(PageKySlReq pageKySlReq) throws OrderReceiveException; List<PageKySlRsp> queryAvailableSlList(PageKySlReq pageKySlReq) throws OrderReceiveException;
R fillRedMessage(Map<String,String> param); R fillRedMessage(Map<String,String> param);
R ratioConversion(List<String> orderInfoIds,String ratio,String xhfNsrsbh);
} }

@ -52,7 +52,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 订单信息业务层 * 订单信息业务层
@ -1608,6 +1611,28 @@ public class OrderInfoServiceImpl implements OrderInfoService {
} }
@Override
public R ratioConversion(List<String> orderInfoIds,String ratio,String xhfNsrsbh){
//校验是否为同一税号 校验开票情况
//根据税号+ orderinfoid查询明细信息
List<OrderProcessInfo> orderProcessInfos = orderProcessInfoMapper.selectByOrderIds(orderInfoIds, Arrays.asList(xhfNsrsbh));
List<String> collect = orderProcessInfos.stream().filter(t -> "0,1,2,3".contains(t.getDdzt())).map(t -> t.getDdh()).collect(Collectors.toList());
List<OrderItemInfo> orderItemInfos = orderItemInfoMapper.selectAllByOrderId(orderInfoIds, Arrays.asList(xhfNsrsbh));
if(orderItemInfos == null ||orderItemInfos.isEmpty()){
return R.error("当前明细为空不允许进行单位换算");
}
orderItemInfos.forEach(t->{
if(StringUtils.isNotBlank(t.getXmsl())){
t.setXmsl(new BigDecimal(t.getXmsl()).multiply(new BigDecimal(ratio)).setScale(8, RoundingMode.HALF_UP).toString());
t.setXmdj(new BigDecimal(t.getXmje()).divide(new BigDecimal(t.getXmsl()),8,RoundingMode.HALF_UP).toString());
}
});
//更新明细表
orderItemInfoMapper.updateOrderItemId(orderItemInfos);
return R.ok();
}
private PageKySlRsp getDefaultKySlList(OrderInfoEnum orderInfoEnum){ private PageKySlRsp getDefaultKySlList(OrderInfoEnum orderInfoEnum){
PageKySlRsp pageKySlRsp = new PageKySlRsp(); PageKySlRsp pageKySlRsp = new PageKySlRsp();
pageKySlRsp.setSl(orderInfoEnum.getKey()); pageKySlRsp.setSl(orderInfoEnum.getKey());

@ -1,5 +1,7 @@
package com.dxhy.order.consumer.modules.unitconversion.entity; package com.dxhy.order.consumer.modules.unitconversion.entity;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -8,6 +10,7 @@ import java.io.Serializable;
* @author Gong Quanlin * @author Gong Quanlin
* @since 2023-03-18 14:49:16 * @since 2023-03-18 14:49:16
*/ */
@Data
public class UnitConversion implements Serializable { public class UnitConversion implements Serializable {
private static final long serialVersionUID = -36936011982521247L; private static final long serialVersionUID = -36936011982521247L;
/** /**
@ -18,6 +21,10 @@ public class UnitConversion implements Serializable {
* 销方税号 * 销方税号
*/ */
private String xhfNsrsbh; private String xhfNsrsbh;
/**
* 销方名称
*/
private String xhfMc;
/** /**
* 数据权限id * 数据权限id
*/ */
@ -34,54 +41,4 @@ public class UnitConversion implements Serializable {
* 比率 * 比率
*/ */
private String rate; private String rate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getXhfNsrsbh() {
return xhfNsrsbh;
}
public void setXhfNsrsbh(String xhfNsrsbh) {
this.xhfNsrsbh = xhfNsrsbh;
}
public String getEntId() {
return entId;
}
public void setEntId(String entId) {
this.entId = entId;
}
public String getOriginUnit() {
return originUnit;
}
public void setOriginUnit(String originUnit) {
this.originUnit = originUnit;
}
public String getNewUnit() {
return newUnit;
}
public void setNewUnit(String newUnit) {
this.newUnit = newUnit;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
} }

@ -14,6 +14,8 @@ public class UnitConversionDTO extends UnitConversion {
private String id; private String id;
@NotEmpty(message = "销货方纳税人识别号不能为空!") @NotEmpty(message = "销货方纳税人识别号不能为空!")
private String xhfNsrsbh; private String xhfNsrsbh;
@NotEmpty(message = "销货方名称不能为空!")
private String xhfMc;
@NotEmpty(message = "数据权限id不能为空!") @NotEmpty(message = "数据权限id不能为空!")
private String entId; private String entId;
@NotEmpty(message = "原单位不能为空!") @NotEmpty(message = "原单位不能为空!")
@ -101,4 +103,12 @@ public class UnitConversionDTO extends UnitConversion {
public void setRate(String rate) { public void setRate(String rate) {
this.rate = rate; this.rate = rate;
} }
public String getXhfMc() {
return xhfMc;
}
public void setXhfMc(String xhfMc) {
this.xhfMc = xhfMc;
}
} }

@ -88,7 +88,9 @@ public class InvoiceOpenGateRestApi {
|| OrderInfoEnum.INTERFACE_BUSINESS_ID_TBPZH.getKey().equals(requestParam.getIS_INPUT().getIFYWID()) || OrderInfoEnum.INTERFACE_BUSINESS_ID_TBPZH.getKey().equals(requestParam.getIS_INPUT().getIFYWID())
){ ){
interfaceName = ConfigurerInfo.transferTojx; interfaceName = ConfigurerInfo.transferTojx;
}else { }else if(OrderInfoEnum.INTERFACE_BUSINESS_ID_ZYKSSFFM.getKey().equals(requestParam.getIS_INPUT().getIFYWID())){
interfaceName = ConfigurerInfo.SYNC_ACCOUNT_INFO;
} else {
log.error("{}-山能对外接口PO业务接口ID:{},未定义", LOGGER_MESSAGE_V6, requestParam.getIS_INPUT().getIFYWID()); log.error("{}-山能对外接口PO业务接口ID:{},未定义", LOGGER_MESSAGE_V6, requestParam.getIS_INPUT().getIFYWID());
return "请传输正确的业务ID"; return "请传输正确的业务ID";
} }

@ -399,14 +399,19 @@ public class InvoiceRestApiV6 {
}else if(ConfigurerInfo.transferTojx.equals(interfaceName)){ }else if(ConfigurerInfo.transferTojx.equals(interfaceName)){
log.info("开始调用进项接口"); log.info("开始调用进项接口");
//根据发票代码 + 号码更新字段 //根据发票代码 + 号码更新字段
// PoCommonRequestParam requestParam = JsonUtils.getInstance().parseObject(reqStr, PoCommonRequestParam.class);
// String result = interfaceServiceV3.syncAccountInfo(requestParam);
Map<String,String> headMap = new HashMap<>(); Map<String,String> headMap = new HashMap<>();
headMap.put("token",ConfigureConstant.POTOKEN); headMap.put("token",ConfigureConstant.POTOKEN);
String s = HttpUtils.doPostWithHeader(jxUrl,reqStr,headMap); String s = HttpUtils.doPostWithHeader(jxUrl,reqStr,headMap);
log.info("进项接口返回:{}",s); log.info("进项接口返回:{}",s);
return s; return s;
} else if(ConfigurerInfo.transferTojx.equals(interfaceName)){
PoCommonRequestParam requestParam = JsonUtils.getInstance().parseObject(reqStr, PoCommonRequestParam.class);
String result = interfaceServiceV3.syncAccountInfo(requestParam);
log.info("同步报账单引用发票信息推送给税控系统数据返回:{}",result);
return result;
} else { } else {
returnJsonString = ""; returnJsonString = "";
} }

@ -120,6 +120,24 @@
ORDER BY cc.create_time DESC ORDER BY cc.create_time DESC
</select> </select>
<select id="queryCommodityCodeList" resultMap="commodityCodeResultMap">
<bind name="dataType" value="${dataType}"/>
<include refid="baseSelect"/>
<where>
<if test="encoding != null and encoding != ''">
cc.encoding = #{zxbm}
</if>
<if test="commodityId != null and commodityId != ''" >
cc.commodity_id = #{commodityId}
</if>
<if test="xhfNsrsbh != null and xhfNsrsbh != ''">
AND cc.xhf_nsrsbh = #{xhfNsrsbh}
</if>
ORDER BY cc.create_time DESC
</where>
ORDER BY cc.create_time DESC
</select>
<select id="queryCommodityCodeByZxbmAndXhfNsrsbh" resultMap="commodityCodeResultMap"> <select id="queryCommodityCodeByZxbmAndXhfNsrsbh" resultMap="commodityCodeResultMap">
<bind name="dataType" value="${dataType}"/> <bind name="dataType" value="${dataType}"/>
@ -380,6 +398,115 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateCommodityCode" >
UPDATE buyer_manage_info
<set>
<if test="commodityId != null">
commodity_id = #{commodityId},
</if>
<if test="sortId != null">
sort_id = #{sortId},
</if>
<if test="xmmc != null">
merchandise_name = #{xmmc},
</if>
<if test="zxbm != null">
encoding = #{zxbm},
</if>
<if test="spsm != null">
tax_items = #{spsm},
</if>
<if test="spjm != null">
brief_code = #{spjm},
</if>
<if test="sl != null">
tax_rate = #{sl},
</if>
<if test="ggxh != null">
specification_model = #{ggxh},
</if>
<if test="xmdw != null">
metering_unit = #{xmdw},
</if>
<if test="xmdj != null">
unit_price = #{xmdj},
</if>
<if test="hsbz != null">
tax_logo = #{hsbz},
</if>
<if test="ycbz != null">
hide_the_logo = #{ycbz},
</if>
<if test="yhzcbs != null">
enjoy_preferential_policies = #{yhzcbs},
</if>
<if test="spbm != null">
tax_class_code = #{spbm},
</if>
<if test="ssflMc != null">
tax_classification_name = #{ssflMc},
</if>
<if test="lslbs != null">
preferential_policies_type = #{lslbs},
</if>
<if test="zzstsgl != null">
zzstsgl = #{zzstsgl},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
create_time,
modify_time,
<if test="modifyUserId != null">
modify_user_id = #{modifyUserId},
</if>
<if test="groupId != null">
group_id = #{groupId},
</if>
<if test="bz != null">
description = #{bz},
</if>
<if test="xhfMc != null">
enterprise_name = #{xhfMc},
</if>
<if test="dataSource != null">
data_source = #{dataSource},
</if>
<if test="matchingState != null">
matching_state = #{matchingState},
</if>
<if test="dataState != null">
data_state = #{dataState},
</if>
<if test="spjc != null">
tax_class_abbreviation = #{spjc},
</if>
<if test="collectIdent != null">
collect_ident = #{collectIdent},
</if>
<if test="cpy != null">
cpy = #{cpy},
</if>
<if test="bmbBbh != null">
bmb_bbh = #{bmbBbh},
</if>
<if test="jdc != null">
jdc = #{jdc},
</if>
<if test="wlflbm != null">
wlflbm = #{wlflbm},
</if>
<if test="wlflmc != null">
wlflmc = #{wlflmc},
</if>
<if test="entId != null">
ent_id = #{entId},
</if>
</set>
<where>
id = #{buyer.id,jdbcType=VARCHAR}
</where>
</update>
<delete id="deleteCommodityCodeByXhfNsrsbh"> <delete id="deleteCommodityCodeByXhfNsrsbh">
delete delete

@ -676,6 +676,33 @@
</foreach> </foreach>
</if> </if>
</select> </select>
<select id="selectByOrderIds" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from order_process_info
where
order_info_id in
<foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
#{orderId,jdbcType=VARCHAR}
</foreach>
<if test="shList != null and shList.size() == 0">
and xhf_nsrsbh = ''
</if>
<if test="shList != null and shList.size() == 1">
and xhf_nsrsbh =
<foreach collection="shList" index="index" item="item">
#{item}
</foreach>
</if>
<if test="shList != null and shList.size() > 1">
and xhf_nsrsbh in
<foreach collection="shList" index="index" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<!-- 根据条件统计订单条数 --> <!-- 根据条件统计订单条数 -->

@ -5,6 +5,7 @@
<resultMap type="com.dxhy.order.consumer.modules.unitconversion.entity.UnitConversion" id="UnitConversionMap"> <resultMap type="com.dxhy.order.consumer.modules.unitconversion.entity.UnitConversion" id="UnitConversionMap">
<result property="id" column="id" jdbcType="VARCHAR"/> <result property="id" column="id" jdbcType="VARCHAR"/>
<result property="xhfNsrsbh" column="xhf_nsrsbh" jdbcType="VARCHAR"/> <result property="xhfNsrsbh" column="xhf_nsrsbh" jdbcType="VARCHAR"/>
<result property="xhfMc" column="xhf_mc" jdbcType="VARCHAR"/>
<result property="entId" column="ent_id" jdbcType="VARCHAR"/> <result property="entId" column="ent_id" jdbcType="VARCHAR"/>
<result property="originUnit" column="origin_unit" jdbcType="VARCHAR"/> <result property="originUnit" column="origin_unit" jdbcType="VARCHAR"/>
<result property="newUnit" column="new_unit" jdbcType="VARCHAR"/> <result property="newUnit" column="new_unit" jdbcType="VARCHAR"/>
@ -14,7 +15,7 @@
<!--查询单个--> <!--查询单个-->
<select id="queryById" resultMap="UnitConversionMap"> <select id="queryById" resultMap="UnitConversionMap">
select select
id, xhf_nsrsbh, ent_id, origin_unit, new_unit, rate id, xhf_nsrsbh,xhf_mc, ent_id, origin_unit, new_unit, rate
from unit_conversion from unit_conversion
where id = #{id} where id = #{id}
</select> </select>
@ -22,7 +23,7 @@
<!--查询指定行数据--> <!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="UnitConversionMap"> <select id="queryAllByLimit" resultMap="UnitConversionMap">
select select
id, xhf_nsrsbh, ent_id, origin_unit, new_unit, rate id, xhf_nsrsbh,xhf_mc, ent_id, origin_unit, new_unit, rate
from unit_conversion from unit_conversion
limit #{offset}, #{limit} limit #{offset}, #{limit}
</select> </select>
@ -30,7 +31,7 @@
<!--通过实体作为筛选条件查询--> <!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="UnitConversionMap"> <select id="queryAll" resultMap="UnitConversionMap">
select select
id, xhf_nsrsbh, ent_id, origin_unit, new_unit, rate id, xhf_nsrsbh,xhf_mc, ent_id, origin_unit, new_unit, rate
from unit_conversion from unit_conversion
<where> <where>
<if test="id != null and id != ''"> <if test="id != null and id != ''">
@ -56,8 +57,8 @@
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> <insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into unit_conversion(id,xhf_nsrsbh, ent_id, origin_unit, new_unit, rate) insert into unit_conversion(id,xhf_nsrsbh,xhf_mc, ent_id, origin_unit, new_unit, rate)
values (#{id},#{xhfNsrsbh}, #{entId}, #{originUnit}, #{newUnit}, #{rate}) values (#{id},#{xhfNsrsbh},#{xhfMc}, #{entId}, #{originUnit}, #{newUnit}, #{rate})
</insert> </insert>
<!--通过主键修改数据--> <!--通过主键修改数据-->
@ -67,6 +68,9 @@
<if test="xhfNsrsbh != null and xhfNsrsbh != ''"> <if test="xhfNsrsbh != null and xhfNsrsbh != ''">
xhf_nsrsbh = #{xhfNsrsbh}, xhf_nsrsbh = #{xhfNsrsbh},
</if> </if>
<if test="xhfMc != null and xhfMc != ''">
xhf_mc = #{xhfMc},
</if>
<if test="entId != null and entId != ''"> <if test="entId != null and entId != ''">
ent_id = #{entId}, ent_id = #{entId},
</if> </if>

@ -56,4 +56,5 @@ public interface OrderItemInfoMapper {
*/ */
int insertOrderItemByList(@Param("list") List<OrderItemInfo> resultOrderItemList); int insertOrderItemByList(@Param("list") List<OrderItemInfo> resultOrderItemList);
int updateOrderItemId(@Param("list") List<OrderItemInfo> resultOrderItemList);
} }

@ -269,4 +269,21 @@
</foreach> </foreach>
</if> </if>
</insert> </insert>
<update id="updateOrderItemId" parameterType="com.dxhy.order.model.OrderItemInfo">
<bind name="dataType" value="${dataType}"/>
<foreach collection="list" item="item" separator=";">
UPDATE order_item_info
<set>
<if test="item.xmsl != null ">
xmsl = #{item.xmsl,jdbcType=VARCHAR},
</if>
<if test="item.xmdj != null ">
xmdj = #{item.xmdj,jdbcType=VARCHAR},
</if>
</set>
<where>
id = #{item.id,jdbcType=VARCHAR}
</where>
</foreach>
</update>
</mapper> </mapper>

Loading…
Cancel
Save