57b4b5a94a75b09cab0fda3360c41591b1581f5b.svn-base 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. package cn.com.goldenwater.dcproj.service.impl.fjpjlgl;
  2. import cn.com.goldenwater.dcproj.dao.BisInspFjpjlglDao;
  3. import cn.com.goldenwater.dcproj.dao.BisInspFjpjlglTrgtDao;
  4. import cn.com.goldenwater.dcproj.model.BisInspFjpjlgl;
  5. import cn.com.goldenwater.dcproj.model.BisInspFjpjlglTrgt;
  6. import cn.com.goldenwater.dcproj.model.BisInspQaScore;
  7. import cn.com.goldenwater.dcproj.param.BisInspFjpjlglTrgtParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspFjpjlglTrgtService;
  9. import cn.com.goldenwater.core.service.AbstractCrudService;
  10. import cn.com.goldenwater.target.CheckException;
  11. import com.github.pagehelper.PageHelper;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Service;
  14. import org.springframework.transaction.annotation.Transactional;
  15. import cn.com.goldenwater.id.util.UuidUtil;
  16. import java.util.*;
  17. import java.util.concurrent.atomic.DoubleAdder;
  18. import java.util.concurrent.atomic.LongAdder;
  19. /**
  20. * @author lhc
  21. * @date 2023-11-7
  22. */
  23. @Service
  24. @Transactional
  25. public class BisInspFjpjlglTrgtServiceImpl extends AbstractCrudService<BisInspFjpjlglTrgt, BisInspFjpjlglTrgtParam> implements BisInspFjpjlglTrgtService {
  26. @Autowired
  27. private BisInspFjpjlglTrgtDao bisInspFjpjlglTrgtDao;
  28. @Autowired
  29. private BisInspFjpjlglDao bisInspFjpjlglDao;
  30. public BisInspFjpjlglTrgtServiceImpl(BisInspFjpjlglTrgtDao bisInspFjpjlglTrgtDao) {
  31. super(bisInspFjpjlglTrgtDao);
  32. this.bisInspFjpjlglTrgtDao = bisInspFjpjlglTrgtDao;
  33. }
  34. @Override
  35. public int insert(BisInspFjpjlglTrgt bisInspFjpjlglTrgt) {
  36. String uuid = UuidUtil.uuid(); // 生成uuid
  37. bisInspFjpjlglTrgt.setId(uuid);
  38. bisInspFjpjlglTrgt.setIntm(new Date());
  39. bisInspFjpjlglTrgt.setUptm(new Date());
  40. bisInspFjpjlglTrgt.setDataStat("0");
  41. int insert = bisInspFjpjlglTrgtDao.insert(bisInspFjpjlglTrgt);
  42. scoreProcessing(bisInspFjpjlglTrgt);
  43. return insert;
  44. }
  45. @Override
  46. public int update(BisInspFjpjlglTrgt bisInspFjpjlglTrgt) {
  47. scoreProcessing(bisInspFjpjlglTrgt);
  48. bisInspFjpjlglTrgt.setUptm(new Date());
  49. return this.bisInspFjpjlglTrgtDao.update(bisInspFjpjlglTrgt);
  50. }
  51. @Override
  52. public int delete(String id) {
  53. return this.bisInspFjpjlglTrgtDao.delete(id);
  54. }
  55. /**
  56. * 分数处理
  57. *
  58. * @param obj 对象
  59. */
  60. private void scoreProcessing(BisInspFjpjlglTrgt obj) {
  61. Double total1 = 0.0;//合计
  62. Double lac1 = 0.0;//缺项合计
  63. if(obj.getF111()==null){
  64. lac1 = lac1 + 2.0;
  65. }else{
  66. total1= total1+obj.getF111();
  67. }
  68. if(obj.getF112()==null){
  69. lac1 = lac1 + 8.0;
  70. }else{
  71. total1= total1+obj.getF112();
  72. }
  73. if(obj.getF113()==null){
  74. lac1 = lac1 + 5.0;
  75. }else{
  76. total1= total1+obj.getF113();
  77. }
  78. if(obj.getF114()==null){
  79. lac1 = lac1 + 5.0;
  80. }else{
  81. total1= total1+obj.getF114();
  82. }
  83. if(obj.getF115()==null){
  84. lac1 = lac1 + 5.0;
  85. }else{
  86. total1= total1+obj.getF115();
  87. }
  88. if(obj.getF116()==null){
  89. lac1 = lac1 + 5.0;
  90. }else{
  91. total1= total1+obj.getF116();
  92. }
  93. if(obj.getF121()==null){
  94. lac1 = lac1 + 5.0;
  95. }else{
  96. total1= total1+obj.getF121();
  97. }
  98. if(obj.getF122()==null){
  99. lac1 = lac1 + 5.0;
  100. }else{
  101. total1= total1+obj.getF122();
  102. }
  103. if(obj.getF123()==null){
  104. lac1 = lac1 + 5.0;
  105. }else{
  106. total1= total1+obj.getF123();
  107. }
  108. if(obj.getF124()==null){
  109. lac1 = lac1 + 20.0;
  110. }else{
  111. total1= total1+obj.getF124();
  112. }
  113. if(obj.getF125()==null){
  114. lac1 = lac1 + 5.0;
  115. }else{
  116. total1= total1+obj.getF125();
  117. }
  118. if(obj.getF131()==null){
  119. lac1 = lac1 + 5.0;
  120. }else{
  121. total1= total1+obj.getF131();
  122. }
  123. if(obj.getF132()==null){
  124. lac1 = lac1 + 5.0;
  125. }else{
  126. total1= total1+obj.getF132();
  127. }
  128. if(obj.getF141()==null){
  129. lac1 = lac1 + 10.0;
  130. }else{
  131. total1= total1+obj.getF141();
  132. }
  133. if(obj.getF142()==null){
  134. lac1 = lac1 + 10.0;
  135. }else{
  136. total1= total1+obj.getF142();
  137. }
  138. if(obj.getF143()==null){
  139. lac1 = lac1 + 10.0;
  140. }else{
  141. total1= total1+obj.getF143();
  142. }
  143. if(obj.getF144()==null){
  144. lac1 = lac1 + 10.0;
  145. }else{
  146. total1= total1+obj.getF144();
  147. }
  148. if(obj.getF145()==null){
  149. lac1 = lac1 + 10.0;
  150. }else{
  151. total1= total1+obj.getF145();
  152. }
  153. if(obj.getF146()==null){
  154. lac1 = lac1 + 10.0;
  155. }else{
  156. total1= total1+obj.getF146();
  157. }
  158. if(obj.getF151()==null){
  159. lac1 = lac1 + 5.0;
  160. }else{
  161. total1= total1+obj.getF151();
  162. }
  163. if(obj.getF152()==null){
  164. lac1 = lac1 + 5.0;
  165. }else{
  166. total1= total1+obj.getF152();
  167. }
  168. if(obj.getF161()==null){
  169. lac1 = lac1 + 20.0;
  170. }else{
  171. total1= total1+obj.getF161();
  172. }
  173. BisInspFjpjlgl rgstr = bisInspFjpjlglDao.get(obj.getRgstrId());
  174. if (rgstr == null) {
  175. throw new CheckException("未找到此登记表");
  176. }
  177. //算总分和缺项、评分率
  178. Double tatl = judge(total1)+judge(rgstr.getSystemTatl())+judge(rgstr.getTvetTatl())+judge(rgstr.getImgrTatl())
  179. + judge(rgstr.getSafdlTatl())+judge(rgstr.getEmTatl())+judge(rgstr.getAmTatl())+judge(rgstr.getCimtTatl());
  180. Double lacSoc = judge(lac1)+judge(rgstr.getSystemLac())+judge(rgstr.getTvetLac())+judge(rgstr.getImgrLac())
  181. + judge(rgstr.getSafdlLac())+judge(rgstr.getEmLac())+judge(rgstr.getAmLac())+judge(rgstr.getCimtLac());
  182. BisInspFjpjlgl bisInspFjpjlgl = new BisInspFjpjlgl();
  183. bisInspFjpjlgl.setId(rgstr.getId());
  184. bisInspFjpjlgl.setTrgtTatl(total1);
  185. bisInspFjpjlgl.setTrgtLac(lac1);
  186. bisInspFjpjlgl.setTrgtStat(obj.getState());
  187. //设置总分和评定得分
  188. if(tatl!=null || tatl != 0){
  189. bisInspFjpjlgl.setTatl(Math.round(tatl*10.0)/10.0);
  190. Double soc = 1000-lacSoc;
  191. if(soc!=null && soc != 0){
  192. Double ratSoc = tatl/(1000-lacSoc)*100;
  193. bisInspFjpjlgl.setRatSoc(Math.round(ratSoc*10.0)/10.0);
  194. }
  195. }
  196. bisInspFjpjlgl.setState("1");
  197. bisInspFjpjlgl.setUptm(new Date());
  198. bisInspFjpjlglDao.update(bisInspFjpjlgl);
  199. }
  200. private Double judge(Double value) {
  201. if (Objects.isNull(value)) {
  202. return 0.0;
  203. }
  204. return value;
  205. }
  206. }