| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707 |
- package com.goafanti.organization.service.impl;
- import java.io.UnsupportedEncodingException;
- import java.math.BigDecimal;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.UUID;
- import javax.mail.MessagingException;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.goafanti.admin.bo.AdminListBo;
- import com.goafanti.common.bo.EmailBo;
- import com.goafanti.common.constant.AFTConstants;
- import com.goafanti.common.dao.AdminMapper;
- import com.goafanti.common.dao.CompanyLibraryMapper;
- import com.goafanti.common.dao.FinancialPaymentMapper;
- import com.goafanti.common.dao.NoticeMapper;
- import com.goafanti.common.dao.OfficialFeePriceMapper;
- import com.goafanti.common.dao.PatentPriceMapper;
- import com.goafanti.common.dao.PaymentLogMapper;
- import com.goafanti.common.dao.PaymentNodeMapper;
- import com.goafanti.common.dao.SoftWritingPriceMapper;
- import com.goafanti.common.dao.TOrderPaymentMapper;
- import com.goafanti.common.dao.TOrderTaskMapper;
- import com.goafanti.common.dao.TTaskMidMapper;
- import com.goafanti.common.dao.ThirdPartyCompanyMapper;
- import com.goafanti.common.enums.NoticeStatus;
- import com.goafanti.common.model.CompanyLibrary;
- import com.goafanti.common.model.Notice;
- import com.goafanti.common.model.OfficialFeePrice;
- import com.goafanti.common.model.PatentPrice;
- import com.goafanti.common.model.PaymentLog;
- import com.goafanti.common.model.PaymentNode;
- import com.goafanti.common.model.SoftWritingPrice;
- import com.goafanti.common.model.TOrderPayment;
- import com.goafanti.common.model.ThirdPartyCompany;
- import com.goafanti.common.utils.DateUtils;
- import com.goafanti.common.utils.SendEmailUtil;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.order.bo.TOrderTaskDetailBo;
- import com.goafanti.order.enums.NewOrderDunType;
- import com.goafanti.organization.bo.InputNodeList;
- import com.goafanti.organization.bo.InputPaymentList;
- import com.goafanti.organization.bo.InputPaymentNode;
- import com.goafanti.organization.bo.InuptFinancialPayment;
- import com.goafanti.organization.bo.NoticeInformationBo;
- import com.goafanti.organization.bo.OutPaymentLog;
- import com.goafanti.organization.bo.OutPaymentNode;
- import com.goafanti.organization.bo.OutThirdPartyCompany;
- import com.goafanti.organization.bo.outFinancialPayment;
- import com.goafanti.organization.bo.outNodeList;
- import com.goafanti.organization.bo.outPaymentList;
- import com.goafanti.organization.bo.outOrderPayment;
- import com.goafanti.organization.service.ThirdPartyCompanyService;
- @Service
- public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyCompanyMapper> implements ThirdPartyCompanyService {
- @Autowired
- private ThirdPartyCompanyMapper thirdPartyCompanyMapper;
- @Autowired
- private CompanyLibraryMapper companyLibraryMapper;
- @Autowired
- private PaymentNodeMapper paymentNodeMapper;
- @Autowired
- private TOrderPaymentMapper tOrderPaymentMapper;
- @Autowired
- private PaymentLogMapper paymentLogMapper;
- @Autowired
- private AdminMapper adminMapper;
- @Autowired
- private NoticeMapper noticeMapper;
- @Autowired
- private FinancialPaymentMapper financialPaymentMapper;
- @Autowired
- private TOrderTaskMapper tOrderTaskMapper;
- @Autowired
- private SoftWritingPriceMapper softWritingPriceMapper;
- @Autowired
- private OfficialFeePriceMapper officialFeePriceMapper;
- @Autowired
- private TTaskMidMapper tTaskMidMapper;
- @Autowired
- private PatentPriceMapper patentPriceMapper;
-
-
- @Override
- public int addCompany(ThirdPartyCompany t,Integer calculation) {
- if(calculation==null)calculation=0;
- if (calculation==0) {//0其他 1计算
- CompanyLibrary c=new CompanyLibrary();
- String aid=TokenManager.getAdminId();
- List<Integer> list=companyLibraryMapper.selectName(t.getCompanyName(),1,aid);
- if (list.size()<1) {
- c.setCompanyName(t.getCompanyName());
- c.setAid(aid);
- c.setType(1);//0系统 1录入
- companyLibraryMapper.insertSelectiveGetId(c);
- t.setCid(c.getId());
- }else {
- t.setCid(list.get(0));
- }
- t.setTotalAmount(t.getUnitPrice().multiply(new BigDecimal(t.getQuantity())));
- }
- return thirdPartyCompanyMapper.insertSelective(t);
- }
- @Override
- public int updateCompany(ThirdPartyCompany t) {
- SoftWritingPrice s=new SoftWritingPrice();
- s.setCid(t.getCid());
- s.setMaterial(t.getMaterial());
- s.setUrgent(t.getUrgent());
- List<SoftWritingPrice> list=softWritingPriceMapper.checkSoftWritingPrice(s);
- for (SoftWritingPrice sw : list) {
- t.setUnitPrice(sw.getUnitPrice().multiply(new BigDecimal(t.getQuantity())));
- }
- return thirdPartyCompanyMapper.updateByPrimaryKeySelective(t);
- }
- @Override
- public List<CompanyLibrary> selectVague(String name,Integer type) {
- String aid = null;
- if(type==null)type=1;
- if (type==1) aid=TokenManager.getAdminId();
- return companyLibraryMapper.selectVague(name,type,aid);
- }
- @Override
- public int addPaymentNode(InputPaymentNode p) {
-
- if (StringUtils.isNoneBlank(p.getPartyTimes())) {
- p.setPartyTime(DateUtils.StringToDate(p.getPartyTimes(), AFTConstants.YYYYMMDD));
- }
- return paymentNodeMapper.insertSelective(p);
- }
- @Override
- public boolean addNodeCheck(InputPaymentNode p) {
- ThirdPartyCompany t=thirdPartyCompanyMapper.selectByPrimaryKey(p.getCid());
- if (p.getTotalAmount().compareTo(t.getTotalAmount())>0) {
- return true;
- }
- List<OutPaymentNode> list=paymentNodeMapper.selectByTidAndCid(p.getTid(),p.getCid());
- BigDecimal sum=p.getTotalAmount();
- for (OutPaymentNode pn : list) {
- if (!pn.getId().equals(p.getId())) sum=sum.add(pn.getTotalAmount());
- }
- if (sum.compareTo(t.getTotalAmount())>0) {
- return true;
- }
- return false;
- }
- @Override
- public int updatePaymentNode(InputPaymentNode p) {
- if (StringUtils.isNoneBlank(p.getPartyTimes())) {
- p.setPartyTime(DateUtils.StringToDate(p.getPartyTimes(), AFTConstants.YYYYMMDD));
- }
- return paymentNodeMapper.updateByPrimaryKeySelective(p);
- }
- @Override
- public List<OutThirdPartyCompany> selectCompany(Integer tid) {
- List<OutThirdPartyCompany> list=thirdPartyCompanyMapper.selectByTid(tid);
-
- return list;
- }
- @Override
- public List<OutPaymentNode> selectPaymentNode(Integer tid) {
- List<OutPaymentNode> list=paymentNodeMapper.selectByTid(tid,null);
-
- return list;
- }
- @Override
- public int deleteCompany(String id) {
- if (id.contains(",")) {
- String []ids =id.split(",");
- for (String s : ids) {
- thirdPartyCompanyMapper.deleteByPrimaryKey(Integer.valueOf(s));
- }
- }else thirdPartyCompanyMapper.deleteByPrimaryKey(Integer.valueOf(id));
- return 1;
- }
- @Override
- public int deletePaymentNode(String id) {
- if (id.contains(",")) {
- String []ids =id.split(",");
- for (String s : ids) {
- paymentNodeMapper.deleteByPrimaryKey(Integer.valueOf(s));
- }
- }else paymentNodeMapper.deleteByPrimaryKey(Integer.valueOf(id));
- return 1;
- }
- @Override
- public int addOrderPayment(TOrderPayment p) {
- p.setStatus(0);
- tOrderPaymentMapper.insertSelectiveGetId(p);
- NoticeInformationBo ni=financialPaymentMapper.selectBypidGetNotice(p.getId());
- AdminListBo a =adminMapper.getDeptNameByAid(TokenManager.getAdminId());
- addNoticAndSendEmail(ni,a,NoticeStatus.PAYMENT_NODE.getCode());
- PaymentLog pl=new PaymentLog(p.getId(),0,"发起付款:"+p.getRemarks(),a.getId(),a.getName());
- paymentLogMapper.insertSelective(pl);
- return 1;
- }
- @Override
- public outOrderPayment OrderPaymentDetails(Integer id) {
- TOrderPayment tt=tOrderPaymentMapper.selectByPrimaryKey(id);
- int type=tt.getChooseType();
- return tOrderPaymentMapper.selectByidGetDetails(id,type);
- }
- @Override
- public int updateOrderPayment(TOrderPayment p) {
- TOrderPayment tp=new TOrderPayment();
- tp.setId(p.getId());
- tp.setRemarks(p.getRemarks());
- tp.setStatus(p.getStatus());
- Integer type=NoticeStatus.PAYMENT_NODE.getCode();
- String auditStr="重新发起付款:";
- //状态 0审核 1待支付 2驳回 3已支付 4取消
- if (p.getStatus()==0) {
- tp.setApplicationAmount(p.getApplicationAmount());
- tp.setChooseType(p.getChooseType());
- tp.setPaymentType(p.getPaymentType());
- tp.setPaymentAmount(p.getPaymentAmount());
- tp.setQuantity(p.getQuantity());
- tp.setPaymentStatus(p.getPaymentStatus());
- NoticeInformationBo ni=financialPaymentMapper.selectBypidGetNotice(p.getId());
- AdminListBo a =adminMapper.getDeptNameByAid(TokenManager.getAdminId());
- addNoticAndSendEmail(ni,a,NoticeStatus.PAYMENT_NODE.getCode());
- PaymentLog pl=new PaymentLog(p.getId(),0,auditStr+p.getAuditNotes()==null?"":p.getAuditNotes(),a.getId(),a.getName());
- paymentLogMapper.insertSelective(pl);
- }else if (p.getStatus()==1) {
- type= NoticeStatus.PAYMENT_YES.getCode();
- tp.setApplicationAmount(p.getApplicationAmount());
- auditStr="审核通过:";
- }else if(p.getStatus()==2) {
- type= NoticeStatus.PAYMENT_NO.getCode();
- tp.setApplicationAmount(p.getApplicationAmount());
- auditStr="审核驳回:";
- }else if (p.getStatus()==3) {
- tp.setPaymentAmount(p.getPaymentAmount()==null?p.getPaymentAmount():p.getApplicationAmount());
- confirmPayment(p);
- auditStr="审核完成";
- }else if(p.getStatus()==4) {
- auditStr="付款取消";
- }
- if (p.getStatus()!=0) {
- NoticeInformationBo ni=financialPaymentMapper.selectBypidGetNotice(p.getId());
- AdminListBo a =adminMapper.getDeptNameByAid(TokenManager.getAdminId());
- addNoticAndSendEmail(ni,a,type);
- PaymentLog pl=new PaymentLog(p.getId(),p.getStatus(),auditStr+p.getAuditNotes()==null?"":p.getAuditNotes(),a.getId(),a.getName());
- paymentLogMapper.insertSelective(pl);
- }
-
- return tOrderPaymentMapper.updateByPrimaryKeySelective(tp);
-
- }
- private void confirmPayment(TOrderPayment p) {
- //如果确定支付
- int flag=0;
- TOrderPayment tp=tOrderPaymentMapper.selectByPrimaryKey(p.getId());
- ThirdPartyCompany tpc=new ThirdPartyCompany();
- if (p.getPaymentAmount()==null||p.getPaymentAmount().compareTo(new BigDecimal(0))==0) {
- p.setPaymentAmount(tp.getApplicationAmount());
- }
- if (tp.getChooseType()==1) {
- PaymentNode pn=paymentNodeMapper.selectByPrimaryKey(tp.getNodeId());
- BigDecimal count=pn.getTotalAmount();
- BigDecimal party=pn.getPartyAmount();
- party=party.add(p.getPaymentAmount());
- if (party.compareTo(new BigDecimal(0))==0) {
- flag=0;
- }else if (party.compareTo(count)==0) {
- flag=2;
- }else if (party.compareTo(count)==-1) {
- flag=1;
- }
- pn.setStatus(flag);
- pn.setPartyAmount(p.getPaymentAmount());
- paymentNodeMapper.updateByPrimaryKeySelective(pn);
- tpc=thirdPartyCompanyMapper.selectByPrimaryKey(pn.getCid());
- }else {
- tpc=thirdPartyCompanyMapper.selectByPrimaryKey(tp.getTpcId());
- }
- TOrderPayment used=tOrderPaymentMapper.selectByPrimaryKey(p.getId());
- tpc.setPartyAmount(tpc.getPartyAmount().add(p.getPaymentAmount()));
- tTaskMidMapper.updatePaymentAmount(used.getTid(), tp.getPaymentAmount(), 0);
- financialPaymentMapper.updateOrderCost(p.getId(),p.getPaymentAmount());
- thirdPartyCompanyMapper.updateByPrimaryKeySelective(tpc);
- }
- @Override
- public List<OutPaymentLog> selectPaymentLog(Integer id) {
- return paymentLogMapper.selectByPid(id);
- }
- @Override
- public List<outOrderPayment> selectOrderPayment(Integer id) {
- return tOrderPaymentMapper.selectByTid(id);
- }
- @Override
- public int addfinancialPayment(InuptFinancialPayment f) {
- f.setPaymentTime(DateUtils.StringToDate(f.getPaymentTimes(), AFTConstants.YYYYMMDD));
- // financialPaymentMapper.updateOrderCost(f.getPid(),f.getPartyAmount());
- // NoticeInformationBo ni=financialPaymentMapper.selectBypidGetNotice(f.getPid());
- // AdminListBo a =adminMapper.getDeptNameByAid(TokenManager.getAdminId());
- // addNoticAndSendEmail(ni,a,NoticeStatus.PAYMENT_COMPLETE.getCode());
- financialPaymentMapper.insertSelectiveGetId(f);
- return f.getId();
- }
- @Override
- public List<outFinancialPayment> selectfinancialPayment(Integer id) {
- return financialPaymentMapper.selectByPid(id);
- }
- public void addNoticAndSendEmail(NoticeInformationBo in,AdminListBo a,Integer type) {
- String str=NoticeStatus.getValueByCode(type)+": 订单编号 -"+in.getOrderNo()+
- ",客户名称:"+in.getBuyerName()+", 操作人:"+a.getName()+"-"+a.getDepartmentName()+"。";
- Notice n =new Notice();
- EmailBo bo = new EmailBo(NoticeStatus.getValueByCode(type), a.getEmail(), a.getDepartmentName(), a.getName(),
- in.getOrderNo(), in.getSalesmanName());
- n.setId(UUID.randomUUID().toString());
- if (type==NoticeStatus.PAYMENT_NODE.getCode()) {
- n.setAid(in.getFinanceId());
- bo.setAddress(in.getFinanceEmail());
- } else {
- n.setAid(in.getSalesmanId());
- bo.setAddress(in.getSalesmanEmail());
- }
-
- n.setNoticeType(type);
- n.setContent(str);
- n.setReaded(0);//未读
- noticeMapper.insertSelective(n);
- if(StringUtils.isNotBlank(a.getEmail())) {
- try {
- SendEmailUtil.getInstance().send(bo);
- } catch (UnsupportedEncodingException | MessagingException e) {
- e.printStackTrace();
- }
- }
- }
- @Override
- public boolean checkPayment(TOrderPayment p) {
- BigDecimal total=new BigDecimal(0);
- BigDecimal a=p.getApplicationAmount();
- List<outOrderPayment> list=new ArrayList<>();
- //支付种类 0第三方 1催款
-
- if (p.getChooseType()==0) {
- //首先不能大于第三方
- list=tOrderPaymentMapper.selectList(p.getTpcId(),null);
- }else if (p.getChooseType()==1) {
- list=tOrderPaymentMapper.selectList(null,p.getNodeId());
- }
- for (outOrderPayment o : list) {
- if (o.getApplicationAmount()!=null) {
- a=a.add(o.getApplicationAmount());
- }
- }
- if (p.getChooseType()==0) {
- ThirdPartyCompany t=thirdPartyCompanyMapper.selectByPrimaryKey(p.getTpcId());
- total=t.getTotalAmount();
- }else if (p.getChooseType()==1) {
- PaymentNode n=paymentNodeMapper.selectByPrimaryKey(p.getNodeId());
- total=n.getTotalAmount();
- }
- if (a.compareTo(total) != 1) {
- return false;
- }
- return true;
- }
- @Override
- public boolean checkprojectDun(TOrderPayment p) {
- PaymentNode pn=paymentNodeMapper.selectByPrimaryKey(p.getNodeId());
- TOrderTaskDetailBo tt=tOrderTaskMapper.getOrderTaskDetail(p.getTid().toString());
- // 项目状态 0-项目待提交 1-项目已提交,2-项目评审,3-项目立项,4-项目公示,5-项目抽查,6-项目备案,7-项目下证,8-项目验收,
- // 9-项目拨款 10- 项目进度10% 11- 项目进度30% 12- 项目进度70%
- if (pn.getDunType()==0&&pn.getPartyTime().getTime()<new Date().getTime()) {//如果自定义则看触发时间
- return false;
- }else if (NewOrderDunType.CGZH_WC.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>7&&tt.getProjectStatus()<10)) {
- return false;
- }else if (NewOrderDunType.COMMON_NGS.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>3&&tt.getProjectStatus()<10)) {
- return false;
- }else if (NewOrderDunType.COMMON_XZ.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>6&&tt.getProjectStatus()<10)) {
- return false;
- } else if (NewOrderDunType.KJXM_LX.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>2&&tt.getProjectStatus()<10)) {
- return false;
- } else if (NewOrderDunType.KJXM_BK.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>8&&tt.getProjectStatus()<10)) {
- return false;
- } else if (NewOrderDunType.KJJR_BK.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>8&&tt.getProjectStatus()<10)) {
- return false;
- } else if (NewOrderDunType.RJKF_LX.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>2&&tt.getProjectStatus()<10)) {
- return false;
- } else if (NewOrderDunType.RJKF_WZ.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>7&&tt.getProjectStatus()<10)) {
- return false;
- } else if (NewOrderDunType.ZSCQ_GS_SL_XZ.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())) {
- if (tt.getBpType()==1&&(tt.getProjectStatus()>7&&tt.getProjectStatus()<10)) {
- return false;
- }else if (tt.getBpType()!=1&&(tt.getProjectStatus()>3&&tt.getProjectStatus()<10)){
- return false;
- }
- } else if (NewOrderDunType.ZSCQ_XZ.getCode()==Integer.valueOf(""+pn.getProjectType()+pn.getDunType())
- &&(tt.getProjectStatus()>6&&tt.getProjectStatus()<10)) {
- return false;
- }
-
- return true;
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<outPaymentList> selectPaymentList(InputPaymentList i) {
- Map<String, Object> map =new HashMap<>();
- map.put("aid", TokenManager.getAdminId());
- if (i.getContractNo()!=null)map.put("contractNo", i.getContractNo());
- if (i.getOrderNo()!=null)map.put("orderNo", i.getOrderNo());
- if (i.getUserName()!=null)map.put("userName", i.getUserName());
- if (i.getDepId()!=null)map.put("depId", i.getDepId());
- if (i.getAname()!=null)map.put("aname", i.getAname());
- if (i.getFinanceName()!=null)map.put("financeName", i.getFinanceName());
- if (i.getCname()!=null)map.put("cname", i.getCname());
- if (i.getPname()!=null)map.put("pname", i.getPname());
- if (i.getStatus()!=null)map.put("status", i.getStatus());
- if (TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)) {
- map.put("lvl", 1);
- }else if (TokenManager.hasRole(AFTConstants.FINANCE_ADMIN)||TokenManager.hasRole(AFTConstants.VICE_CEO)||
- TokenManager.hasRole(AFTConstants.CED)||TokenManager.hasRole(AFTConstants.SUPERADMIN)||
- TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)) {
- map.put("lvl", 2);
- }else {
- map.put("lvl", 0);
- }
- return (Pagination<outPaymentList>)findPage("selectPaymentList","selectPaymentCount",
- map,i.getPageNo(),i.getPageSize());
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<outNodeList> selectPaymentList(InputNodeList i) {
- Map<String, Object> map =new HashMap<>();
- map.put("aid", TokenManager.getAdminId());
- if (i.getContractNo()!=null)map.put("contractNo", i.getContractNo());
- if (i.getOrderNo()!=null)map.put("orderNo", i.getOrderNo());
- if (i.getUserName()!=null)map.put("userName", i.getUserName());
- if (i.getCname()!=null)map.put("cname", i.getCname());
- if (i.getPname()!=null)map.put("pname", i.getPname());
- if (i.getStatus()!=null)map.put("status", i.getStatus());
- if (i.getStartTime()!=null&&i.getEndTime()!=null) {
- map.put("startTime", DateUtils.StringToDate(i.getStartTime(), AFTConstants.YYYYMMDD));
- map.put("endTime", DateUtils.StringToDate(i.getEndTime()+" 23:59:59", AFTConstants.YYYYMMDDHHMMSS));
- }
- if (TokenManager.hasRole(AFTConstants.FINANCE)) {
- map.put("lvl", 1);
- }else if (TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)) {
- map.put("lvl", 2);
- }else if (TokenManager.hasRole(AFTConstants.FINANCE_ADMIN)||TokenManager.hasRole(AFTConstants.VICE_CEO)||
- TokenManager.hasRole(AFTConstants.CED)||TokenManager.hasRole(AFTConstants.SUPERADMIN)||
- TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)) {
- map.put("lvl", 3);
- }else {
- map.put("lvl", 0);
- }
- return (Pagination<outNodeList>)findPage("selectNodeList","selectNodeCount",
- map,i.getPageNo(),i.getPageSize());
- }
- @Override
- public int insertSoftWritingPrice(SoftWritingPrice s) {
-
- return softWritingPriceMapper.insertSelective(s);
- }
- @Override
- public int updateSoftWritingPrice(SoftWritingPrice s) {
-
- return softWritingPriceMapper.updateByPrimaryKeySelective(s);
- }
- @Override
- public Integer pushSelectByCid(String companyName,int i) {
- String aid=null;
- if (i==1) {
- aid=TokenManager.getAdminId();
- }
- List<Integer> list=companyLibraryMapper.selectName(companyName,i,aid);
- if (list.size()<1) {
- CompanyLibrary c=new CompanyLibrary();
- c.setCompanyName(companyName);
- companyLibraryMapper.insertSelectiveGetId(c);
- return c.getId();
- }else {
- return list.get(0);
- }
-
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<SoftWritingPrice> listSoftWritingPrice(SoftWritingPrice s, Integer pageNo, Integer pageSize) {
- Map<String, Object> map =new HashMap<>();
- map.put("s", s);
- return (Pagination<SoftWritingPrice>)findPage("softWritingPriceList","softWritingPriceCount",
- map,pageNo,pageSize);
- }
- @Override
- public int deleteSoftWritingPrice(Integer id) {
- return softWritingPriceMapper.deleteByPrimaryKey(id);
- }
- @Override
- public boolean checkSoftWritingPrice(SoftWritingPrice s) {
- SoftWritingPrice sw=new SoftWritingPrice();
- if(s.getId()!=null)sw=softWritingPriceMapper.selectByPrimaryKey(s.getId());
- if (s.getId()!=null) {
- s.setCid(sw.getCid());
- }
- List<SoftWritingPrice>list=softWritingPriceMapper.checkSoftWritingPrice(s);
- if (list.size()<1) {
- return false;
- }else if (list.size()==1&&s.getId()!=null) {
- for (SoftWritingPrice ss : list) {
- if(ss.getId().equals(s.getId()))return false;
- }
- }
- return true;
- }
- @Override
- public Map<String ,Object> updateGroupPayment(String ids) {
- String [] idss=ids.split(",");
- List<Integer>elist=new ArrayList<>();
- List<Integer> list=new ArrayList<>();
- for (String s : idss) {
- TOrderPayment top=tOrderPaymentMapper.selectByPrimaryKey(Integer.valueOf(s));
- if (top!=null&&top.getStatus()==1) {
- list.add(top.getId());
- //做已付款金额计算
- confirmPayment(top);
- }else {
- elist.add(Integer.valueOf(s));
- }
- }
- if(!list.isEmpty())tOrderPaymentMapper.updateByids(list);
- Map<String ,Object> map=new HashMap<>();
- map.put("OK", list);
- map.put("fail", elist);
- return map;
- }
- @Override
- public int addOfficialFeePrice(OfficialFeePrice o) {
- return officialFeePriceMapper.insertSelective(o);
- }
- @Override
- public int updateOfficialFeePrice(OfficialFeePrice o) {
- return officialFeePriceMapper.updateByPrimaryKeySelective(o);
- }
- @Override
- public int deleteOfficialFeePrice(Integer id) {
- return officialFeePriceMapper.deleteByPrimaryKey(id);
- }
- @Override
- public List<OfficialFeePrice> listOfficialFeePrice(String name) {
- return officialFeePriceMapper.selectListByname(name);
- }
- @Override
- public int deleteFinancialPayment(Integer id) {
- return financialPaymentMapper.deleteByPrimaryKey(id);
- }
- @Override
- public void calculationUnitPrice(ThirdPartyCompany t) {
- SoftWritingPrice s=new SoftWritingPrice();
- int i=0;
- s.setCid(t.getCid());
- s.setMaterial(t.getMaterial());
- s.setUrgent(t.getUrgent());
- List<SoftWritingPrice> list=softWritingPriceMapper.checkSoftWritingPrice(s);
- for (SoftWritingPrice sw : list) {
- t.setUnitPrice(sw.getUnitPrice());
- t.setTotalAmount(sw.getUnitPrice().multiply(new BigDecimal(t.getQuantity())));
- }
- }
-
- @Override
- public void calculationPatentUnitPrice(ThirdPartyCompany t,Integer patentType) {
- PatentPrice p=patentPriceMapper.selectBycid(t.getCid());
- // 专利名称 0实用新型 1发明专利 2外观专利 3 其他
- BigDecimal unitPrice=null;
- if (patentType==0) {
- unitPrice=p.getUtilityModel();
- }else if (patentType==1) {
- unitPrice=p.getInventionPatent();
- }else if (patentType==2) {
- unitPrice=p.getAppearancePatent();
- }
- t.setUnitPrice(unitPrice);
- t.setTotalAmount(unitPrice.multiply(new BigDecimal(t.getQuantity())));
- }
- @Override
- public int addpatentPrice(PatentPrice p) {
- return patentPriceMapper.insertSelective(p);
- }
- @Override
- public int updatepatentPrice(PatentPrice p) {
- return patentPriceMapper.updateByPrimaryKeySelective(p);
- }
- @Override
- public int deletepatentPrice(Integer id) {
- return patentPriceMapper.deleteByPrimaryKey(id);
- }
- @Override
- public List<PatentPrice> listpatentPrice(String name) {
- return patentPriceMapper.selectlist(name);
- }
-
-
-
- }
|