|
|
@@ -23,6 +23,7 @@ import com.goafanti.cognizance.service.OrgCognizanceService;
|
|
|
import com.goafanti.common.dao.OrgCognizanceLogMapper;
|
|
|
import com.goafanti.common.dao.OrgCognizanceMapper;
|
|
|
import com.goafanti.common.dao.OrganizationIdentityMapper;
|
|
|
+import com.goafanti.common.enums.OrgCognizanceStatus;
|
|
|
import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.OrgCognizance;
|
|
|
import com.goafanti.common.model.OrgCognizanceLog;
|
|
|
@@ -30,14 +31,15 @@ import com.goafanti.common.model.OrganizationIdentity;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+
|
|
|
@Service
|
|
|
public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper> implements OrgCognizanceService {
|
|
|
@Autowired
|
|
|
- private OrgCognizanceMapper orgCognizanceMapper;
|
|
|
+ private OrgCognizanceMapper orgCognizanceMapper;
|
|
|
@Autowired
|
|
|
- private OrgCognizanceLogMapper orgCognizanceLogMapper;
|
|
|
+ private OrgCognizanceLogMapper orgCognizanceLogMapper;
|
|
|
@Autowired
|
|
|
- private OrganizationIdentityMapper organizationIdentityMapper;
|
|
|
+ private OrganizationIdentityMapper organizationIdentityMapper;
|
|
|
|
|
|
@Override
|
|
|
public OrgCognizance insert(OrgCognizance c) {
|
|
|
@@ -47,23 +49,26 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
- public Pagination<CognizanceBo> listCognizance(String uid, String unitName, String locationProvince, Integer pageNo,
|
|
|
+ public Pagination<CognizanceBo> listCognizance(String uid, String unitName, String locationProvince, Integer pageNo,
|
|
|
Integer pageSize) {
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
|
|
- if (!StringUtils.isBlank(unitName)){
|
|
|
+ if (!TokenManager.hasRole("999999")) {
|
|
|
+ params.put("principal", TokenManager.getAdminId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(unitName)) {
|
|
|
params.put("unitName", unitName);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(uid)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(uid)) {
|
|
|
params.put("uid", uid);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(locationProvince)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(locationProvince)) {
|
|
|
params.put("locationProvince", locationProvince);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if (pageNo == null || pageNo < 0) {
|
|
|
pageNo = 1;
|
|
|
}
|
|
|
@@ -71,22 +76,22 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
if (pageSize == null || pageSize < 0) {
|
|
|
pageSize = 10;
|
|
|
}
|
|
|
- return (Pagination<CognizanceBo>) findPage("findCognizanceBoByPage","findCognizanceBoCount", params, pageNo,
|
|
|
+ return (Pagination<CognizanceBo>) findPage("findCognizanceBoByPage", "findCognizanceBoCount", params, pageNo,
|
|
|
pageSize);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
- public CognizanceDetailBo selectCognizanceDetailBo(String uid, String cid, Integer year){
|
|
|
+ public CognizanceDetailBo selectCognizanceDetailBo(String uid, String cid, Integer year) {
|
|
|
CognizanceDetailBo cog = new CognizanceDetailBo();
|
|
|
-
|
|
|
+
|
|
|
CognizanceOrgInfoBo orgInfo = orgCognizanceMapper.selectCognizanceOrgInfoBoByUidAndCid(uid, cid);
|
|
|
- if (null != orgInfo){
|
|
|
+ if (null != orgInfo) {
|
|
|
cog.setUid(null == orgInfo.getUid() ? "" : orgInfo.getUid());
|
|
|
cog.setCid(null == orgInfo.getCid() ? "" : orgInfo.getCid());
|
|
|
cog.setUnitName(null == orgInfo.getUnitName() ? "" : orgInfo.getUnitName());
|
|
|
cog.setOrgCode(null == orgInfo.getOrgCode() ? "" : orgInfo.getOrgCode());
|
|
|
cog.setPostalAddress(null == orgInfo.getPostalAddress() ? "" : orgInfo.getPostalAddress());
|
|
|
- cog.setContacts(null == orgInfo.getContacts() ? "" : orgInfo.getContacts().toString());//联系人
|
|
|
+ cog.setContacts(null == orgInfo.getContacts() ? "" : orgInfo.getContacts().toString());// 联系人
|
|
|
cog.setTechnicalField1(null == orgInfo.getTechnicalField1() ? 0 : orgInfo.getTechnicalField1());
|
|
|
cog.setTechnicalField2(null == orgInfo.getTechnicalField2() ? 0 : orgInfo.getTechnicalField2());
|
|
|
cog.setTechnicalField3(null == orgInfo.getTechnicalField3() ? 0 : orgInfo.getTechnicalField3());
|
|
|
@@ -94,7 +99,7 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
null == orgInfo.getBasicResearchCost() ? new BigDecimal(0) : orgInfo.getBasicResearchCost());
|
|
|
cog.setAccident(null == orgInfo.getAccient() ? 0 : orgInfo.getAccient());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
CognizanceResearchCostBo researchCost = orgCognizanceMapper.selectCognizanceResearchCostBoByUidAndYear(year,
|
|
|
uid);
|
|
|
if (null != researchCost) {
|
|
|
@@ -102,22 +107,28 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
null == researchCost.getResearchCost() ? new BigDecimal(0) : researchCost.getResearchCost());
|
|
|
cog.setTerritory(null == researchCost.getTerritory() ? new BigDecimal(0) : researchCost.getTerritory());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
CognizanceManageCostBo manageCost = orgCognizanceMapper.selectCognizanceManageCostBoByUidAndYear(year, uid);
|
|
|
if (null != manageCost) {
|
|
|
cog.setNetAsset1(null == manageCost.getNetAsset1() ? new BigDecimal(0) : manageCost.getNetAsset1());
|
|
|
cog.setNetAsset2(null == manageCost.getNetAsset2() ? new BigDecimal(0) : manageCost.getNetAsset2());
|
|
|
cog.setNetAsset3(null == manageCost.getNetAsset3() ? new BigDecimal(0) : manageCost.getNetAsset3());
|
|
|
- cog.setSalesRevenue1(null == manageCost.getSalesRevenue1() ? new BigDecimal(0) : manageCost.getSalesRevenue1());
|
|
|
- cog.setSalesRevenue2(null == manageCost.getSalesRevenue2() ? new BigDecimal(0) : manageCost.getSalesRevenue2());
|
|
|
- cog.setSalesRevenue3(null == manageCost.getSalesRevenue3() ? new BigDecimal(0) : manageCost.getSalesRevenue3());
|
|
|
- cog.setGrossProfit1(null == manageCost.getGrossProfit1() ? new BigDecimal(0) : manageCost.getGrossProfit1());
|
|
|
- cog.setGrossProfit2(null == manageCost.getGrossProfit2() ? new BigDecimal(0) : manageCost.getGrossProfit2());
|
|
|
- cog.setGrossProfit3(null == manageCost.getGrossProfit3() ? new BigDecimal(0) : manageCost.getGrossProfit3());
|
|
|
+ cog.setSalesRevenue1(
|
|
|
+ null == manageCost.getSalesRevenue1() ? new BigDecimal(0) : manageCost.getSalesRevenue1());
|
|
|
+ cog.setSalesRevenue2(
|
|
|
+ null == manageCost.getSalesRevenue2() ? new BigDecimal(0) : manageCost.getSalesRevenue2());
|
|
|
+ cog.setSalesRevenue3(
|
|
|
+ null == manageCost.getSalesRevenue3() ? new BigDecimal(0) : manageCost.getSalesRevenue3());
|
|
|
+ cog.setGrossProfit1(
|
|
|
+ null == manageCost.getGrossProfit1() ? new BigDecimal(0) : manageCost.getGrossProfit1());
|
|
|
+ cog.setGrossProfit2(
|
|
|
+ null == manageCost.getGrossProfit2() ? new BigDecimal(0) : manageCost.getGrossProfit2());
|
|
|
+ cog.setGrossProfit3(
|
|
|
+ null == manageCost.getGrossProfit3() ? new BigDecimal(0) : manageCost.getGrossProfit3());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
CognizanceCatagoryBo catagory = orgCognizanceMapper.selectCognizanceCatagoryBoByUidAndYear(year, uid);
|
|
|
- if (null != catagory){
|
|
|
+ if (null != catagory) {
|
|
|
cog.setFirstCatagory(null == catagory.getFirstCatagory() ? 0 : catagory.getFirstCatagory());
|
|
|
cog.setSecondCatagory(null == catagory.getSecondCatagory() ? 0 : catagory.getSecondCatagory());
|
|
|
cog.setFirmTotal(null == catagory.getFirmTotal() ? 0 : catagory.getFirmTotal());
|
|
|
@@ -171,26 +182,27 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
|
|
|
@Override
|
|
|
public void updateCognizance(OrgCognizance cog, OrgCognizanceLog log, Date recordTime, String aid) {
|
|
|
- if (null != log.getState() && null != recordTime && null != cog.getUid() ) {
|
|
|
+ if (null != log.getState() && null != recordTime && null != cog.getUid()) {
|
|
|
log.setRecordTime(recordTime);
|
|
|
- cog.setState(log.getState());
|
|
|
- switch (log.getState()) {
|
|
|
- case 1:
|
|
|
+
|
|
|
+ if (OrgCognizanceStatus.getStatus(cog.getState()) == OrgCognizanceStatus.DELIVERD) {
|
|
|
cog.setCreateTime(recordTime);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
+ } else if (OrgCognizanceStatus.getStatus(cog.getState()) == OrgCognizanceStatus.ACCEPT) {
|
|
|
cog.setAcceptDate(recordTime);
|
|
|
- break;
|
|
|
- case 5:
|
|
|
+ } else if (OrgCognizanceStatus.getStatus(cog.getState()) == OrgCognizanceStatus.ISSUING) {
|
|
|
cog.setIssuingDate(recordTime);
|
|
|
- OrganizationIdentity o = organizationIdentityMapper.selectOrgIdentityByUserId(cog.getUid());
|
|
|
- o.setCertificateNumber(null == cog.getCertificateNumber() ? "" : cog.getCertificateNumber());
|
|
|
- o.setIssuingDate(recordTime);
|
|
|
- o.setConsultant(null == cog.getConsultant() ? "" : cog.getConsultant());
|
|
|
- o.setCogContacts(null == cog.getContacts() ? null : cog.getContacts());
|
|
|
- organizationIdentityMapper.updateByPrimaryKeySelective(o);
|
|
|
- break;
|
|
|
+ OrganizationIdentity o = organizationIdentityMapper.selectOrgIdentityByUserId(cog.getUid());
|
|
|
+ o.setCertificateNumber(null == cog.getCertificateNumber() ? "" : cog.getCertificateNumber());
|
|
|
+ o.setIssuingDate(recordTime);
|
|
|
+ o.setConsultant(null == cog.getConsultant() ? "" : cog.getConsultant());
|
|
|
+ o.setCogContacts(null == cog.getContacts() ? null : cog.getContacts());
|
|
|
+ organizationIdentityMapper.updateByPrimaryKeySelective(o);
|
|
|
}
|
|
|
+
|
|
|
+ if (OrgCognizanceStatus.getStatus(cog.getState()) != OrgCognizanceStatus.CIRCULATION) {
|
|
|
+ cog.setState(OrgCognizanceStatus.DELIVERD.getCode());
|
|
|
+ }
|
|
|
+
|
|
|
log.setId(UUID.randomUUID().toString());
|
|
|
log.setCid(cog.getId());
|
|
|
log.setOperator(aid);
|
|
|
@@ -200,15 +212,9 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void insertCognizance(Integer contacts, String comment, Integer year, Integer state, String aid, String uid) {
|
|
|
- OrgCognizance c = new OrgCognizance();
|
|
|
+ public void insertCognizance(OrgCognizance c, String aid) {
|
|
|
c.setId(UUID.randomUUID().toString());
|
|
|
- c.setUid(uid);
|
|
|
- c.setContacts(contacts);
|
|
|
- c.setComment(comment);
|
|
|
c.setDeletedSign(0);
|
|
|
- c.setYear(year);
|
|
|
- c.setState(state);
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
now.set(Calendar.MILLISECOND, 0);
|
|
|
c.setRecordTime(now.getTime());
|
|
|
@@ -217,35 +223,35 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
OrgCognizanceLog log = new OrgCognizanceLog();
|
|
|
log.setId(UUID.randomUUID().toString());
|
|
|
log.setCid(c.getId());
|
|
|
-
|
|
|
+
|
|
|
log.setRecordTime(c.getCreateTime());
|
|
|
- log.setState(state);
|
|
|
- log.setComment(comment);
|
|
|
- log.setPrincipal(aid);
|
|
|
- if (TokenManager.getToken() instanceof Admin) {
|
|
|
+ log.setState(c.getState());
|
|
|
+ log.setPrincipal(null == aid && TokenManager.getToken() instanceof Admin? TokenManager.getAdminId() : "");
|
|
|
+ if (TokenManager.getToken() instanceof Admin) {
|
|
|
log.setOperator(TokenManager.getAdminId());
|
|
|
}
|
|
|
orgCognizanceLogMapper.insert(log);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
- public Pagination<CultivationListBo> listCultivation(String uid, String province, String unitName, Integer pageNo, Integer pageSize) {
|
|
|
+ public Pagination<CultivationListBo> listCultivation(String uid, String province, String unitName, Integer pageNo,
|
|
|
+ Integer pageSize) {
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(unitName)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(unitName)) {
|
|
|
params.put("unitName", unitName);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(uid)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(uid)) {
|
|
|
params.put("uid", uid);
|
|
|
}
|
|
|
-
|
|
|
- if (!StringUtils.isBlank(province)){
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(province)) {
|
|
|
params.put("province", province);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (pageNo == null || pageNo < 0) {
|
|
|
pageNo = 1;
|
|
|
}
|
|
|
@@ -253,7 +259,7 @@ public class OrgCognizanceServiceImpl extends BaseMybatisDao<OrgCognizanceMapper
|
|
|
if (pageSize == null || pageSize < 0) {
|
|
|
pageSize = 10;
|
|
|
}
|
|
|
- return(Pagination<CultivationListBo>) findPage("findCultivationListByPage", "findCultivationCount", params,
|
|
|
+ return (Pagination<CultivationListBo>) findPage("findCultivationListByPage", "findCultivationCount", params,
|
|
|
pageNo, pageSize);
|
|
|
}
|
|
|
}
|