|
|
@@ -4,14 +4,8 @@ import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
import com.jpsoft.enterprise.config.OSSConfig;
|
|
|
import com.jpsoft.enterprise.modules.base.dto.BillDetailDTO;
|
|
|
-import com.jpsoft.enterprise.modules.base.entity.BillDetailInfo;
|
|
|
-import com.jpsoft.enterprise.modules.base.entity.BillInfo;
|
|
|
-import com.jpsoft.enterprise.modules.base.entity.CompanyInfo;
|
|
|
-import com.jpsoft.enterprise.modules.base.entity.OrderInfo;
|
|
|
-import com.jpsoft.enterprise.modules.base.service.BillDetailInfoService;
|
|
|
-import com.jpsoft.enterprise.modules.base.service.BillInfoService;
|
|
|
-import com.jpsoft.enterprise.modules.base.service.CompanyInfoService;
|
|
|
-import com.jpsoft.enterprise.modules.base.service.OrderInfoService;
|
|
|
+import com.jpsoft.enterprise.modules.base.entity.*;
|
|
|
+import com.jpsoft.enterprise.modules.base.service.*;
|
|
|
import com.jpsoft.enterprise.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.enterprise.modules.common.dto.Sort;
|
|
|
import com.jpsoft.enterprise.modules.common.utils.OSSUtil;
|
|
|
@@ -55,6 +49,12 @@ public class BillDetailController {
|
|
|
@Autowired
|
|
|
private OrderInfoService orderInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PersonInfoService personInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MessageReceiverService messageReceiverService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private OSSConfig ossConfig;
|
|
|
|
|
|
@@ -279,10 +279,26 @@ public class BillDetailController {
|
|
|
for (BillDetailInfo billDetailInfo:list) {
|
|
|
billDetailInfo.setRushStatus("1");
|
|
|
billDetailInfo.setUpdateBy(subject);
|
|
|
- billDetailInfo.setUpdateTime(new Date());
|
|
|
+ Date now = new Date();
|
|
|
+ billDetailInfo.setUpdateTime(now);
|
|
|
|
|
|
affectCount += billDetailInfoService.update(billDetailInfo);
|
|
|
|
|
|
+ //推送站内消息
|
|
|
+ List<PersonInfo> personInfoList = personInfoService.findByCompanyId(billDetailInfo.getCompanyId());
|
|
|
+
|
|
|
+ for (PersonInfo personInfo:personInfoList) {
|
|
|
+ MessageReceiver messageReceiver = new MessageReceiver();
|
|
|
+ messageReceiver.setId(UUID.randomUUID().toString());
|
|
|
+ messageReceiver.setReadStatus(false);
|
|
|
+ messageReceiver.setDelFlag(false);
|
|
|
+ messageReceiver.setMessageId("2");//账单推送消息
|
|
|
+ messageReceiver.setPersonId(personInfo.getId());
|
|
|
+ messageReceiver.setCreateBy(subject);
|
|
|
+ messageReceiver.setCreateTime(now);
|
|
|
+
|
|
|
+ messageReceiverService.insert(messageReceiver);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
@@ -423,6 +439,15 @@ public class BillDetailController {
|
|
|
}
|
|
|
dto.setRushStatus(billDetailInfo.getRushStatus());
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(billDetailInfo.getTicketUrl())){
|
|
|
+ dto.setIsTicketUrl(true);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ dto.setIsTicketUrl(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setTicketUrl(billDetailInfo.getTicketUrl());
|
|
|
+
|
|
|
pageDto.add(dto);
|
|
|
}
|
|
|
|
|
|
@@ -557,4 +582,81 @@ public class BillDetailController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="上传发票")
|
|
|
+ @PostMapping("uploadTicket")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "uploadFile",value = "上传文件", required = true,paramType="form", dataType = "__file")
|
|
|
+ })
|
|
|
+ public MessageResult<BillDetailInfo> uploadTicket(MultipartFile uploadFile,String id,String subFolder,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+ MessageResult<BillDetailInfo> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ String retFileUrl = OSSUtil.upload(ossConfig,"/" + subFolder,uploadFile.getOriginalFilename(),uploadFile.getInputStream());
|
|
|
+
|
|
|
+
|
|
|
+ BillDetailInfo billDetailInfo = billDetailInfoService.get(id);
|
|
|
+ billDetailInfo.setTicketUrl(retFileUrl);
|
|
|
+ billDetailInfo.setUpdateBy(subject);
|
|
|
+ billDetailInfo.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int affectCount = billDetailInfoService.update(billDetailInfo);
|
|
|
+
|
|
|
+ if (affectCount > 0) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(billDetailInfo);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库更新失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="获取主账单信息")
|
|
|
+ @GetMapping("getBillInfo/{billId}")
|
|
|
+ public MessageResult<Boolean> getBillInfo(@PathVariable("billId") String billId){
|
|
|
+ MessageResult<Boolean> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ boolean showPushBtn = false;
|
|
|
+
|
|
|
+ List<BillDetailInfo> list = billDetailInfoService.findByBillId(billId);
|
|
|
+
|
|
|
+ for (BillDetailInfo billDetailInfo:list) {
|
|
|
+ OrderInfo orderInfo = orderInfoService.get(billDetailInfo.getOrderId());
|
|
|
+ if(orderInfo!=null){
|
|
|
+ if(orderInfo.getPayStatus()==20){
|
|
|
+ showPushBtn = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(showPushBtn);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|