Merge remote-tracking branch 'origin/master'

This commit is contained in:
韩鹏辉
2024-04-03 14:20:49 +08:00
5 changed files with 48 additions and 30 deletions

View File

@@ -34,7 +34,7 @@ public class TbPrintPCMachineController {
*/ */
@GetMapping @GetMapping
public Result queryByPage(TbPrintPCMachine tbPrintMachine) { public Result queryByPage(TbPrintPCMachine tbPrintMachine) {
return this.tbPrintPCMachineService.queryByPage(tbPrintMachine); return tbPrintPCMachineService.queryByPage(tbPrintMachine);
} }
/** /**

View File

@@ -19,6 +19,7 @@ public class TbOrderDetail implements Serializable {
private Integer productSkuId; private Integer productSkuId;
private Integer num; private Integer num;
private Integer returnNum;
private String productName; private String productName;
private String status; private String status;

View File

@@ -70,11 +70,11 @@ public class DutyService {
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId,day); ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId,day);
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId()); // ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
BigDecimal cashAmount = BigDecimal.ZERO; BigDecimal cashAmount = BigDecimal.ZERO;
if (type.equals("create")) {
if (orderInfo.getPayType().equals("cash")) { if (orderInfo.getPayType().equals("cash")) {
cashAmount = orderInfo.getPayAmount(); cashAmount = orderInfo.getPayAmount();
} }
if (type.equals("create")) {
if (Objects.isNull(shopUserDuty)) { if (Objects.isNull(shopUserDuty)) {
shopUserDuty = new ShopUserDuty(userId, tbToken.getCreateTime(), 1, orderInfo.getOrderAmount(), loginName, "0", shopUserDuty = new ShopUserDuty(userId, tbToken.getCreateTime(), 1, orderInfo.getOrderAmount(), loginName, "0",
orderInfo.getOrderAmount(), shopId, BigDecimal.ZERO, cashAmount, BigDecimal.ZERO, ""); orderInfo.getOrderAmount(), shopId, BigDecimal.ZERO, cashAmount, BigDecimal.ZERO, "");

View File

@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@@ -41,15 +42,15 @@ public class TbPrintPCMachineService {
public Result queryById(Integer id) { public Result queryById(Integer id) {
TbPrintPCMachine tbPrintMachine = tbPrintMachineMapper.queryById(id); TbPrintPCMachine tbPrintMachine = tbPrintMachineMapper.queryById(id);
if(tbPrintMachine==null){ if (tbPrintMachine == null) {
return Result.fail("数据不存在"); return Result.fail("数据不存在");
} }
PrintMachineDto tbPrintMachineVO=new PrintMachineDto(); PrintMachineDto tbPrintMachineVO = new PrintMachineDto();
if (StringUtils.isNotBlank(tbPrintMachine.getConfig())){ if (StringUtils.isNotBlank(tbPrintMachine.getConfig())) {
tbPrintMachineVO.setConfig(JSON.parseObject(tbPrintMachine.getConfig(), PrintConfig.class)); tbPrintMachineVO.setConfig(JSON.parseObject(tbPrintMachine.getConfig(), PrintConfig.class));
} }
BeanUtils.copyProperties(tbPrintMachine,tbPrintMachineVO); BeanUtils.copyProperties(tbPrintMachine, tbPrintMachineVO);
return Result.success(CodeEnum.SUCCESS,tbPrintMachineVO); return Result.success(CodeEnum.SUCCESS, tbPrintMachineVO);
} }
/** /**
@@ -62,8 +63,20 @@ public class TbPrintPCMachineService {
PageHelper.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize()); PageHelper.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize());
tbPrintMachine.setContentType("local"); tbPrintMachine.setContentType("local");
List<TbPrintPCMachine> tbPrintMachines = this.tbPrintMachineMapper.queryAll(tbPrintMachine); List<TbPrintPCMachine> tbPrintMachines = this.tbPrintMachineMapper.queryAll(tbPrintMachine);
PageInfo pageInfo=new PageInfo(tbPrintMachines);
return Result.success(CodeEnum.SUCCESS,pageInfo); List<PrintMachineDto> printMachineList = new ArrayList<>();
for (TbPrintPCMachine printMachine : tbPrintMachines) {
PrintMachineDto tbPrintMachineVO = new PrintMachineDto();
if (StringUtils.isNotBlank(printMachine.getConfig())) {
tbPrintMachineVO.setConfig(JSON.parseObject(printMachine.getConfig(), PrintConfig.class));
}
BeanUtils.copyProperties(printMachine, tbPrintMachineVO);
printMachineList.add(tbPrintMachineVO);
}
PageInfo pageInfo = new PageInfo(tbPrintMachines);
pageInfo.setList(printMachineList);
return Result.success(CodeEnum.SUCCESS, pageInfo);
} }
/** /**
@@ -76,13 +89,13 @@ public class TbPrintPCMachineService {
TbPrintPCMachine tbPrintMachine = new TbPrintPCMachine(); TbPrintPCMachine tbPrintMachine = new TbPrintPCMachine();
tbPrintMachine.setCreatedAt(Instant.now().toEpochMilli()); tbPrintMachine.setCreatedAt(Instant.now().toEpochMilli());
tbPrintMachine.setContentType("local"); tbPrintMachine.setContentType("local");
if (resources.getConfig() != null){ if (resources.getConfig() != null) {
if(CollectionUtils.isEmpty(resources.getConfig().getCategoryList())){ if (CollectionUtils.isEmpty(resources.getConfig().getCategoryList())) {
resources.getConfig().setCategoryList(null); resources.getConfig().setCategoryList(null);
} }
tbPrintMachine.setConfig(JSONUtil.toJSONString(resources.getConfig(),true)); tbPrintMachine.setConfig(JSONUtil.toJSONString(resources.getConfig(), true));
} }
BeanUtils.copyProperties(resources,tbPrintMachine); BeanUtils.copyProperties(resources, tbPrintMachine);
tbPrintMachineMapper.insert(tbPrintMachine); tbPrintMachineMapper.insert(tbPrintMachine);
return Result.success(CodeEnum.SUCCESS); return Result.success(CodeEnum.SUCCESS);
} }
@@ -96,10 +109,10 @@ public class TbPrintPCMachineService {
public Result update(PrintMachineDto resources) { public Result update(PrintMachineDto resources) {
TbPrintPCMachine tbPrintMachine = new TbPrintPCMachine(); TbPrintPCMachine tbPrintMachine = new TbPrintPCMachine();
tbPrintMachine.setUpdatedAt(Instant.now().toEpochMilli()); tbPrintMachine.setUpdatedAt(Instant.now().toEpochMilli());
if (resources.getConfig() != null){ if (resources.getConfig() != null) {
tbPrintMachine.setConfig(JSONUtil.toJSONString(resources.getConfig(),true)); tbPrintMachine.setConfig(JSONUtil.toJSONString(resources.getConfig(), true));
} }
BeanUtils.copyProperties(resources,tbPrintMachine); BeanUtils.copyProperties(resources, tbPrintMachine);
tbPrintMachineMapper.update(tbPrintMachine); tbPrintMachineMapper.update(tbPrintMachine);
return Result.success(CodeEnum.SUCCESS); return Result.success(CodeEnum.SUCCESS);
} }

View File

@@ -8,6 +8,7 @@
<result column="product_id" jdbcType="INTEGER" property="productId"/> <result column="product_id" jdbcType="INTEGER" property="productId"/>
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId"/> <result column="product_sku_id" jdbcType="INTEGER" property="productSkuId"/>
<result column="num" jdbcType="INTEGER" property="num"/> <result column="num" jdbcType="INTEGER" property="num"/>
<result column="return_num" jdbcType="INTEGER" property="returnNum"/>
<result column="product_name" jdbcType="VARCHAR" property="productName"/> <result column="product_name" jdbcType="VARCHAR" property="productName"/>
<result column="product_sku_name" jdbcType="VARCHAR" property="productSkuName"/> <result column="product_sku_name" jdbcType="VARCHAR" property="productSkuName"/>
<result column="product_img" jdbcType="VARCHAR" property="productImg"/> <result column="product_img" jdbcType="VARCHAR" property="productImg"/>
@@ -20,7 +21,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, order_id, shop_id, product_id, product_sku_id, num, product_name, product_sku_name, id, order_id, shop_id, product_id, product_sku_id, num, product_name, product_sku_name,
product_img, create_time, update_time, price, price_amount,status,pack_amount product_img, create_time, update_time, price, price_amount,status,pack_amount,return_num
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
@@ -154,6 +155,9 @@
<if test="num != null"> <if test="num != null">
num = #{num,jdbcType=INTEGER}, num = #{num,jdbcType=INTEGER},
</if> </if>
<if test="returnNum != null">
return_num = #{returnNum,jdbcType=INTEGER},
</if>
<if test="productName != null"> <if test="productName != null">
product_name = #{productName,jdbcType=VARCHAR}, product_name = #{productName,jdbcType=VARCHAR},
</if> </if>