|
|
@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.huyi.service.base.entity.ZcBillFileRel;
|
|
|
-import com.huyi.service.base.entity.ZcBillInf;
|
|
|
-import com.huyi.service.base.entity.ZcBillInvoiceRel;
|
|
|
-import com.huyi.service.base.entity.ZcInvoiceInf;
|
|
|
+import com.huyi.service.base.entity.*;
|
|
|
import com.huyi.service.base.service.*;
|
|
|
import com.huyi.service.bill.service.IOwnBillService;
|
|
|
import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
|
|
|
@@ -76,6 +73,9 @@ public class OwnBillController extends BaseController {
|
|
|
private ISysUserService iSysUserService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ISysCompanyService iSysCompanyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private RemoteFileService remoteFileService;
|
|
|
|
|
|
/**
|
|
|
@@ -143,12 +143,18 @@ public class OwnBillController extends BaseController {
|
|
|
Map map = new HashMap();
|
|
|
if (zcBillInf != null) {
|
|
|
com.huyi.service.base.entity.SysUser user = iSysUserService.getById(zcBillInf.getCreateBy());
|
|
|
+ SysCompany payer = iSysCompanyService.getById(zcBillInf.getZbiPayerId());
|
|
|
+ SysCompany payee = iSysCompanyService.getById(zcBillInf.getZbiPayeeId());
|
|
|
BeanMap beanMap = BeanMap.create(zcBillInf);
|
|
|
for (Object key : beanMap.keySet()) {
|
|
|
map.put(key+"", beanMap.get(key));
|
|
|
}
|
|
|
//创建人
|
|
|
map.put("createUser",user.getNickName());
|
|
|
+ //付款方
|
|
|
+ map.put("payerName",payer.getScyName());
|
|
|
+ //收款方
|
|
|
+ map.put("payeeName",payee.getScyName());
|
|
|
}
|
|
|
return AjaxResult.success(map);
|
|
|
}
|
|
|
@@ -218,9 +224,9 @@ public class OwnBillController extends BaseController {
|
|
|
iZcBillInfService.createZcBillInf(zcBillInf);
|
|
|
}else{
|
|
|
zcBillInf.setZbiId(zbiId);
|
|
|
- //创建人
|
|
|
+ //修改人
|
|
|
zcBillInf.setUpdateBy(user.getUserid().toString());
|
|
|
- //创建时间
|
|
|
+ //修改时间
|
|
|
zcBillInf.setUpdateTime(DateUtils.getNowDate());
|
|
|
iZcBillInfService.updateZcBillInf(zcBillInf);
|
|
|
}
|
|
|
@@ -231,6 +237,44 @@ public class OwnBillController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 往来账款发票金额计算
|
|
|
+ */
|
|
|
+ @Log(title = "往来账款金额计算修改", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping(value = "getAmount")
|
|
|
+ public AjaxResult getBillAmount(@RequestParam(required = false,value = "zbiId") String zbiId) {
|
|
|
+ //获取用户信息
|
|
|
+ LoginUser userInfo = tokenService.getLoginUser();
|
|
|
+ //企业id
|
|
|
+ String companyId = userInfo.getSysUser().getCompanyId();
|
|
|
+ //查询关联往来账款的发票
|
|
|
+ LambdaQueryWrapper<ZcBillInvoiceRel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ //往来账款id
|
|
|
+ lambdaQueryWrapper.eq(ZcBillInvoiceRel::getZbirBillId,zbiId);
|
|
|
+ List<ZcBillInvoiceRel> relList = iZcBillInvoiceRelService.findZcBillInvoiceRels(lambdaQueryWrapper);
|
|
|
+ //账款金额
|
|
|
+ String amount = "0.00";
|
|
|
+ for (ZcBillInvoiceRel zcBillInvoiceRel : relList) {
|
|
|
+ //查询发票
|
|
|
+ ZcInvoiceInf zcInvoiceInf = iZcInvoiceInfService.getById(zcBillInvoiceRel.getZbirInvoiceId());
|
|
|
+ if (!"1".equals(zcInvoiceInf.getZiiCheckStt())) {
|
|
|
+ return AjaxResult.error(500,"存在未验真或验真未通过发票,不可进行账款关联");
|
|
|
+ }
|
|
|
+ //价税合计
|
|
|
+ amount = AmtUtil.add(amount, zcInvoiceInf.getZiiAmount());
|
|
|
+ }
|
|
|
+ ZcBillInf zcBillInf = iZcBillInfService.getById(zbiId);
|
|
|
+ zcBillInf.setZbiId(zbiId);
|
|
|
+ //账款金额
|
|
|
+ zcBillInf.setZbiAmount(amount);
|
|
|
+ //修改人
|
|
|
+ zcBillInf.setUpdateBy(userInfo.getUserid().toString());
|
|
|
+ //修改时间
|
|
|
+ zcBillInf.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ iZcBillInfService.updateZcBillInf(zcBillInf);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取往来账款发票信息
|
|
|
*/
|
|
|
@GetMapping(value = "getInvoice/{zbiId}")
|
|
|
@@ -263,8 +307,8 @@ public class OwnBillController extends BaseController {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String date = sdf.format(map.get("ziiDate"));
|
|
|
map.put("ziiDate",date);
|
|
|
+ list.add(map);
|
|
|
}
|
|
|
- list.add(map);
|
|
|
}
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
@@ -338,6 +382,16 @@ public class OwnBillController extends BaseController {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String date = sdf.format(map.get("ziiDate"));
|
|
|
map.put("ziiDate",date);
|
|
|
+ if("3".equals(map.get("ziiCheckStt"))){
|
|
|
+ //如果是重复状态查询关联往来账款
|
|
|
+ LambdaQueryWrapper<ZcBillInvoiceRel> relQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ //发票代码
|
|
|
+ relQueryWrapper.eq(ZcBillInvoiceRel::getZbirInvoiceId,list.get(0).getZiiId());
|
|
|
+ List<ZcBillInvoiceRel> relList = iZcBillInvoiceRelService.findZcBillInvoiceRels(relQueryWrapper);
|
|
|
+ //查询往来账款名称返回前台展示
|
|
|
+ ZcBillInf zcBillInf = iZcBillInfService.getById(relList.get(0).getZbirBillId());
|
|
|
+ map.put("zbiName",zcBillInf.getZbiName());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//返回发票信息
|
|
|
@@ -354,7 +408,7 @@ public class OwnBillController extends BaseController {
|
|
|
@Transactional(rollbackFor=Exception.class)
|
|
|
@Log(title = "往来账款发票验真", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/invoiceVerification")
|
|
|
- public List<ZcInvoiceInf> invoiceVerification(@RequestParam(required = false,value = "fileList") String fileList) {
|
|
|
+ public List invoiceVerification(@RequestParam(required = false,value = "fileList") String fileList) {
|
|
|
JSONArray jsonArray = JSONArray.parseArray(fileList);
|
|
|
//获取登录用户
|
|
|
LoginUser user = tokenService.getLoginUser();
|
|
|
@@ -369,7 +423,7 @@ public class OwnBillController extends BaseController {
|
|
|
checkNum = num;
|
|
|
}
|
|
|
}
|
|
|
- List<ZcInvoiceInf> zcInvoiceInfs = new ArrayList<>();
|
|
|
+ List zcInvoiceInfs = new ArrayList<>();
|
|
|
//批量验真
|
|
|
for (int i = 0; i < jsonArray.size(); i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
@@ -428,7 +482,27 @@ public class OwnBillController extends BaseController {
|
|
|
zcInvoiceInf.setUpdateTime(DateUtils.getNowDate());
|
|
|
//修改发票信息
|
|
|
iZcInvoiceInfService.updateZcInvoiceInf(zcInvoiceInf);
|
|
|
- zcInvoiceInfs.add(zcInvoiceInf);
|
|
|
+ Map map = new HashMap();
|
|
|
+ //将发票对象转换成Map集合重新组合
|
|
|
+ if (zcInvoiceInf != null) {
|
|
|
+ BeanMap beanMap = BeanMap.create(zcInvoiceInf);
|
|
|
+ for (Object key : beanMap.keySet()) {
|
|
|
+ map.put(key+"", beanMap.get(key));
|
|
|
+ }
|
|
|
+ if("3".equals(map.get("ziiCheckStt"))){
|
|
|
+ //如果是重复状态查询关联往来账款
|
|
|
+ LambdaQueryWrapper<ZcBillInvoiceRel> relQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ //发票代码
|
|
|
+ relQueryWrapper.eq(ZcBillInvoiceRel::getZbirInvoiceId,list.get(0).getZiiId());
|
|
|
+ List<ZcBillInvoiceRel> relList = iZcBillInvoiceRelService.findZcBillInvoiceRels(relQueryWrapper);
|
|
|
+ //查询往来账款名称返回前台展示
|
|
|
+ ZcBillInf zcBillInf = iZcBillInfService.getById(relList.get(0).getZbirBillId());
|
|
|
+ map.put("zbiName",zcBillInf.getZbiName());
|
|
|
+ }else {
|
|
|
+ map.put("zbiName",null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zcInvoiceInfs.add(map);
|
|
|
}
|
|
|
return zcInvoiceInfs;
|
|
|
}
|