This commit is contained in:
19991905653 2024-04-03 14:34:51 +08:00
commit 95e68d745e
8 changed files with 57 additions and 22 deletions

View File

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

View File

@ -35,5 +35,9 @@ public interface ShopUserDutyMapper {
ShopUserDuty selectByShopIdAndTrade(@Param("shopId") Integer shopId,@Param("day") String day);
ShopUserDuty selectByShopIdAndDay(@Param("shopId") Integer shopId,@Param("day") String day);
// List<String> selectByShopIdAndTradeAll(@Param("shopId") Integer shopId,@Param("day") String day,@Param("tokenId") Integer tokenId);
}

View File

@ -18,6 +18,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
registry.addInterceptor(signInterceptor)
.addPathPatterns("/**")
.excludePathPatterns("/login/login")
;
.excludePathPatterns("/cloudPrinter/print")
.excludePathPatterns("/cloudPrinter/handoverPrint");
}
}

View File

@ -30,9 +30,11 @@ public class HandoverInfo implements Serializable {
private String handIn;
private String returnAmount;
private String orderNum;
public HandoverInfo(String merchantName, String startTime, String endTime, String staff, List<PayInfo> payInfos, List<HandoverInfo.MemberData> memberData, String totalAmount, String imprest, String payable, String handIn, String orderNum) {
public HandoverInfo(String merchantName, String startTime, String endTime, String staff, List<PayInfo> payInfos, List<HandoverInfo.MemberData> memberData, String totalAmount, String imprest, String payable, String handIn, String returnAmount,String orderNum) {
this.merchantName = merchantName;
this.startTime = startTime;
this.endTime = endTime;
@ -43,6 +45,7 @@ public class HandoverInfo implements Serializable {
this.imprest = imprest;
this.payable = payable;
this.handIn = handIn;
this.returnAmount=returnAmount;
this.orderNum = orderNum;
}

View File

@ -401,7 +401,7 @@ public class CloudPrinterService {
return;
}
ShopUserDuty shopUserDuty=shopUserDutyMapper.selectByShopIdAndTrade(tbShopInfo.getId(),tradeDay);
ShopUserDuty shopUserDuty=shopUserDutyMapper.selectByShopIdAndDay(tbShopInfo.getId(),tradeDay);
MsgException.checkNull(shopUserDuty,"交班信息不存在");
@ -422,8 +422,17 @@ public class CloudPrinterService {
memberData.add(new HandoverInfo.MemberData(shopUserDutyPay.getAmount().toPlainString(),"储值卡支付"));
}
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())?DateUtils.getTime(shopUserDuty.getLoginTime()):null,ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):"",ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),list,memberData,shopUserDuty.getAmount().toPlainString(),"0",shopUserDuty.getAmount().toPlainString(),shopUserDuty.getAmount().toPlainString(),shopUserDuty.getOrderNum().toString());
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())?DateUtils.getTime(shopUserDuty.getLoginTime()):null,
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):"",
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
list,memberData,shopUserDuty.getAmount().toPlainString(),
"0",
shopUserDuty.getAmount().subtract(shopUserDuty.getReturnAmount()).toPlainString(),
shopUserDuty.getAmount().subtract(shopUserDuty.getReturnAmount()).toPlainString(),
shopUserDuty.getReturnAmount().toPlainString(),
shopUserDuty.getOrderNum().toString()
);
PrinterUtils.printTickets(1,1,it.getAddress(),PrinterUtils.handoverprintData(handoverInfo));

View File

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

View File

@ -167,12 +167,13 @@ public class PrinterUtils {
sb.append("<S> "+payInfo.getPayType()+": "+payInfo.getAmount()+"</S><BR>");
}
}
sb.append("<S>会员数据</S><BR>");
if(ObjectUtil.isNotEmpty(handoverInfo.getMemberData())&&handoverInfo.getMemberData().size()>0){
sb.append("<S>会员数据</S><BR>");
for (HandoverInfo.MemberData memberDatum : handoverInfo.getMemberData()) {
sb.append("<S> "+memberDatum.getDeposit()+": "+memberDatum.getAmount()+"</S><BR>");
}
}
sb.append("<S>退款金额 :".concat(handoverInfo.getReturnAmount())+"</S><BR>");
sb.append("<S>总收入: "+handoverInfo.getTotalAmount()+"</S><BR>");
sb.append("<S>备用金: "+handoverInfo.getImprest()+"</S><BR>");
sb.append("<S>应交金额: "+handoverInfo.getPayable()+"</S><BR>");
@ -182,7 +183,7 @@ public class PrinterUtils {
sb.append("<S>总订单数:"+handoverInfo.getOrderNum()+"</S><BR>");
sb.append("<S>打印时间:"+DateUtils.getTime(new Date())+"</S><BR>");
sb.append("<OUT:180>");
sb.append("<OUT:200>");
sb.append("<PCUT>");
return sb.toString();

View File

@ -224,4 +224,8 @@
<update id="updateStatusByTokenId">
update tb_shop_user_duty set status = '1' , login_out_time = now(),user_id = #{staffId} where shop_id = #{shopId} and trade_day = #{day} and status = '0'
</update>
<select id="selectByShopIdAndDay" resultMap="BaseResultMap">
select * from tb_shop_user_duty where trade_day = #{day} and shop_id = #{shopId} order by id desc limit 1
</select>
</mapper>